From a6a3f1f883e5ff91c32e726b9c8c1ba0db1902b9 Mon Sep 17 00:00:00 2001 From: songlu <37168047+PARADISSEEKR@users.noreply.github.com> Date: Tue, 19 Apr 2022 16:25:50 +0800 Subject: [PATCH] {image-gallery} `az sig create`: Update `--eula` description (#4605) * Update _params.py * SDK --- src/image-gallery/HISTORY.rst | 5 + .../azext_image_gallery/_params.py | 2 +- .../test_shared_gallery_community.yaml | 2 +- .../azure_mgmt_compute/__init__.py | 9 +- .../_compute_management_client.py | 334 +- .../azure_mgmt_compute/_configuration.py | 31 +- .../azure_mgmt_compute/_patch.py | 31 + .../azure_mgmt_compute/_vendor.py | 27 + .../azure_mgmt_compute/aio/__init__.py | 5 + .../aio/_compute_management_client.py | 329 +- .../azure_mgmt_compute/aio/_configuration.py | 18 +- .../azure_mgmt_compute/aio/_patch.py | 31 + .../_availability_sets_operations.py | 393 +- ..._capacity_reservation_groups_operations.py | 350 +- .../_capacity_reservations_operations.py | 392 +- .../_community_galleries_operations.py | 55 +- ...unity_gallery_image_versions_operations.py | 126 +- .../_community_gallery_images_operations.py | 119 +- .../_dedicated_host_groups_operations.py | 327 +- .../operations/_dedicated_hosts_operations.py | 387 +- .../aio/operations/_galleries_operations.py | 420 +- ...gallery_application_versions_operations.py | 411 +- .../_gallery_applications_operations.py | 382 +- .../_gallery_image_versions_operations.py | 405 +- .../operations/_gallery_images_operations.py | 373 +- .../_gallery_sharing_profile_operations.py | 103 +- .../aio/operations/_images_operations.py | 412 +- .../operations/_log_analytics_operations.py | 189 +- .../aio/operations/_operations.py | 62 +- .../_proximity_placement_groups_operations.py | 327 +- .../operations/_resource_skus_operations.py | 79 +- .../_restore_point_collections_operations.py | 358 +- .../operations/_restore_points_operations.py | 218 +- .../_shared_galleries_operations.py | 117 +- ...hared_gallery_image_versions_operations.py | 132 +- .../_shared_gallery_images_operations.py | 125 +- .../operations/_ssh_public_keys_operations.py | 362 +- .../aio/operations/_usage_operations.py | 70 +- ...ual_machine_extension_images_operations.py | 166 +- .../_virtual_machine_extensions_operations.py | 369 +- ...ual_machine_images_edge_zone_operations.py | 267 +- .../_virtual_machine_images_operations.py | 258 +- ...virtual_machine_run_commands_operations.py | 507 +- ...machine_scale_set_extensions_operations.py | 393 +- ...e_scale_set_rolling_upgrades_operations.py | 255 +- ...hine_scale_set_vm_extensions_operations.py | 391 +- ...ne_scale_set_vm_run_commands_operations.py | 421 +- ...irtual_machine_scale_set_vms_operations.py | 1144 +- .../_virtual_machine_scale_sets_operations.py | 1731 +- .../_virtual_machine_sizes_operations.py | 73 +- .../_virtual_machines_operations.py | 1733 +- .../azure_mgmt_compute/models/__init__.py | 946 +- .../_compute_management_client_enums.py | 204 +- .../azure_mgmt_compute/models/_models.py | 13355 ---------------- .../azure_mgmt_compute/models/_models_py3.py | 8711 +++++++--- .../_availability_sets_operations.py | 727 +- ..._capacity_reservation_groups_operations.py | 657 +- .../_capacity_reservations_operations.py | 707 +- .../_community_galleries_operations.py | 111 +- ...unity_gallery_image_versions_operations.py | 232 +- .../_community_gallery_images_operations.py | 219 +- .../_dedicated_host_groups_operations.py | 616 +- .../operations/_dedicated_hosts_operations.py | 690 +- .../operations/_galleries_operations.py | 734 +- ...gallery_application_versions_operations.py | 752 +- .../_gallery_applications_operations.py | 691 +- .../_gallery_image_versions_operations.py | 746 +- .../operations/_gallery_images_operations.py | 679 +- .../_gallery_sharing_profile_operations.py | 178 +- .../operations/_images_operations.py | 726 +- .../operations/_log_analytics_operations.py | 321 +- .../operations/_operations.py | 104 +- .../_proximity_placement_groups_operations.py | 616 +- .../operations/_resource_skus_operations.py | 135 +- .../_restore_point_collections_operations.py | 662 +- .../operations/_restore_points_operations.py | 411 +- .../_shared_galleries_operations.py | 212 +- ...hared_gallery_image_versions_operations.py | 244 +- .../_shared_gallery_images_operations.py | 231 +- .../operations/_ssh_public_keys_operations.py | 690 +- .../operations/_usage_operations.py | 119 +- ...ual_machine_extension_images_operations.py | 340 +- .../_virtual_machine_extensions_operations.py | 685 +- ...ual_machine_images_edge_zone_operations.py | 559 +- .../_virtual_machine_images_operations.py | 530 +- ...virtual_machine_run_commands_operations.py | 914 +- ...machine_scale_set_extensions_operations.py | 702 +- ...e_scale_set_rolling_upgrades_operations.py | 455 +- ...hine_scale_set_vm_extensions_operations.py | 739 +- ...ne_scale_set_vm_run_commands_operations.py | 768 +- ...irtual_machine_scale_set_vms_operations.py | 2079 ++- .../_virtual_machine_scale_sets_operations.py | 3058 ++-- .../_virtual_machine_sizes_operations.py | 125 +- .../_virtual_machines_operations.py | 3042 ++-- src/image-gallery/setup.py | 2 +- 95 files changed, 31858 insertions(+), 32792 deletions(-) create mode 100644 src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_patch.py create mode 100644 src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_vendor.py create mode 100644 src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_patch.py delete mode 100644 src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models.py diff --git a/src/image-gallery/HISTORY.rst b/src/image-gallery/HISTORY.rst index 5d576a26d1d..9e19952b9b9 100644 --- a/src/image-gallery/HISTORY.rst +++ b/src/image-gallery/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +0.1.3 ++++++++++++++++ +* Update SDK +* Update `az sig create --eula` description + 0.1.2 +++++++++++++++ * Add new command `az sig create` to support create a gallery with community sharing info diff --git a/src/image-gallery/azext_image_gallery/_params.py b/src/image-gallery/azext_image_gallery/_params.py index eed3ecddefc..0ca6c44bf0e 100644 --- a/src/image-gallery/azext_image_gallery/_params.py +++ b/src/image-gallery/azext_image_gallery/_params.py @@ -78,7 +78,7 @@ def load_arguments(self, _): 'allowing them to be recovered within retention time.') c.argument('publisher_uri', help='Community gallery publisher uri.') c.argument('publisher_contact', options_list=['--publisher-email'], help='Community gallery publisher contact email.') - c.argument('eula', help='Community gallery publisher eula.') + c.argument('eula', help='community gallery license agreement and privacy statement.') c.argument('public_name_prefix', help='Community gallery public name prefix.') with self.argument_context('sig share enable-community') as c: diff --git a/src/image-gallery/azext_image_gallery/tests/latest/recordings/test_shared_gallery_community.yaml b/src/image-gallery/azext_image_gallery/tests/latest/recordings/test_shared_gallery_community.yaml index 8000509f10f..242bd07c287 100644 --- a/src/image-gallery/azext_image_gallery/tests/latest/recordings/test_shared_gallery_community.yaml +++ b/src/image-gallery/azext_image_gallery/tests/latest/recordings/test_shared_gallery_community.yaml @@ -442,7 +442,7 @@ interactions: User-Agent: - AZURECLI/2.30.0 azsdk-python-azure-mgmt-compute/23.1.0 Python/3.8.9 (Windows-10-10.0.22000-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Compute/galleries/gellery000002/share?api-version=2021-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Compute/galleries/gellery000002/share?api-version=2021-10-01 response: body: string: '' diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/__init__.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/__init__.py index da8181c02bd..fd39b8a6c90 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/__init__.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/__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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_compute_management_client.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_compute_management_client.py index 6f72e91058d..e79f9a5f3db 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_compute_management_client.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_compute_management_client.py @@ -6,116 +6,99 @@ # 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, TYPE_CHECKING -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 azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -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 +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 import TokenCredential -class ComputeManagementClient(object): +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """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 +106,128 @@ 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 api_version: Api Version. Default value is "2021-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ 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: 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_configuration.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_configuration.py index 52e39da71b5..d96d5cd1b7b 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_configuration.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_configuration.py @@ -6,22 +6,20 @@ # 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 -class ComputeManagementClientConfiguration(Configuration): +class ComputeManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ComputeManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class ComputeManagementClientConfiguration(Configuration): :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 + :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ 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) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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 - self.api_version = "2021-07-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-compute/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_patch.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_vendor.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/_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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/__init__.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/__init__.py index 9e945963598..9c044a7dd93 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/__init__.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_compute_management_client.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_compute_management_client.py index 32c2c15af90..98e739578f2 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_compute_management_client.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_compute_management_client.py @@ -6,114 +6,101 @@ # 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, TYPE_CHECKING -from azure.core.pipeline.transport 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 azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -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 +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 -class ComputeManagementClient(object): +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """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 +108,129 @@ 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 api_version: Api Version. Default value is "2021-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_configuration.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_configuration.py index cbb34c44a75..1016cbd75c3 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_configuration.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClientConfiguration(Configuration): +class ComputeManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ComputeManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class ComputeManagementClientConfiguration(Configuration): :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 + :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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 - self.api_version = "2021-07-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-compute/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_patch.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_availability_sets_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_availability_sets_operations.py index c27ba7dcb28..6baaaa4275b 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_availability_sets_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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,33 +71,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AvailabilitySet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,8 +106,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 + 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,33 +136,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AvailabilitySetUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,9 +171,12 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore - async def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -195,26 +198,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -224,8 +226,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + 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,28 +252,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -282,8 +283,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 + 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, @@ -292,48 +296,49 @@ def list_by_subscription( """Lists all availability sets in a subscription. :param expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. + 'instanceView'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -342,7 +347,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -351,11 +360,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 + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -366,44 +377,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -412,7 +425,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,11 +438,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 + 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,45 +459,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -487,7 +509,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -496,7 +522,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes'} # type: ignore + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservation_groups_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservation_groups_operations.py index 77098cdfd6a..0ab6fc360a3 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservation_groups_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservation_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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,33 +73,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -111,8 +112,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 + 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,33 +143,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,9 +178,12 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore - async def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -205,28 +208,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -236,8 +236,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + 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, @@ -254,8 +256,9 @@ async def get( :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve 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 + platform and can change outside of control plane operations. Default value is None. + :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,30 +269,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -302,8 +301,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 + 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, @@ -317,49 +319,52 @@ def list_by_resource_group( :type resource_group_name: str :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 + associated to capacity reservation group in the response. Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -368,7 +373,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -377,11 +386,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 + 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, @@ -392,48 +403,50 @@ 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 + associated to capacity reservation group in the response. Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -442,7 +455,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -451,7 +468,8 @@ 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/capacityReservationGroups'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservations_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservations_operations.py index e98cfe291c0..c0e073b1f37 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservations_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_capacity_reservations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +60,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -100,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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + _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,14 +127,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( @@ -145,28 +154,22 @@ async def begin_create_or_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + api_version=api_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('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: @@ -176,9 +179,9 @@ def get_long_running_output(pipeline_response): 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + 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( self, @@ -193,34 +196,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -235,8 +234,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 + _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,14 +259,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( @@ -278,28 +286,22 @@ async def begin_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + api_version=api_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('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: @@ -309,11 +311,11 @@ def get_long_running_output(pipeline_response): 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -325,29 +327,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -357,9 +356,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -378,14 +379,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -398,25 +402,18 @@ async def begin_delete( resource_group_name=resource_group_name, capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_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: @@ -426,10 +423,11 @@ def get_long_running_output(pipeline_response): 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + 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, @@ -448,8 +446,9 @@ async def get( :type capacity_reservation_name: str :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 + and can change outside of control plane operations. Default value is None. + :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,31 +459,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -497,8 +492,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 + 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,45 +511,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -560,7 +561,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -569,7 +574,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_capacity_reservation_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations'} # type: ignore + list_by_capacity_reservation_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_galleries_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_galleries_operations.py index a633b233dca..a0fc195eb59 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_galleries_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +43,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,28 +66,25 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,4 +97,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_image_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_image_versions_operations.py index 60ca7b0d957..5e9969f54ae 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_image_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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._community_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 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -72,30 +77,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +110,11 @@ 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 + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore + + + @distributed_trace def list( self, location: str, @@ -126,46 +131,50 @@ def list( :param gallery_image_name: The name of the community gallery image definition. :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 CommunityGalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionList] + :return: An iterator like instance of either CommunityGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageVersionList"] error_map = { 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'), - '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 = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CommunityGalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("CommunityGalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,7 +183,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,7 +196,8 @@ 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}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_images_operations.py index 181b4ed139b..caff45e0143 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_community_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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._community_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 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, @@ -66,29 +71,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,8 +103,11 @@ 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 + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}"} # type: ignore + + + @distributed_trace def list( self, location: str, @@ -116,45 +121,48 @@ def list( :param public_gallery_name: The public name of the community gallery. :type public_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 CommunityGalleryImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageList] + :return: An iterator like instance of either CommunityGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageList"] error_map = { 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'), - '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 = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + public_gallery_name=public_gallery_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CommunityGalleryImageList', pipeline_response) + deserialized = self._deserialize("CommunityGalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -163,7 +171,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,7 +184,8 @@ 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}/communityGalleries/{publicGalleryName}/images'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_host_groups_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_host_groups_operations.py index 94b85750b03..bb2a074bf29 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_host_groups_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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,33 +73,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHostGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -111,8 +112,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 + 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,33 +142,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,9 +177,12 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore - async def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -201,26 +204,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -230,8 +232,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + 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, @@ -247,7 +251,7 @@ async def get( :type host_group_name: str :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is - not supported for dedicated host group. + not supported for dedicated host group. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -259,30 +263,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -295,8 +295,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 + 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,44 +311,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -354,7 +359,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -363,11 +372,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 + 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,43 +387,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -421,7 +433,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,7 +446,8 @@ 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/hostGroups'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_hosts_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_hosts_operations.py index 57290ff2827..d0f677a13a5 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_hosts_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +60,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHost') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -100,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/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + _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,14 +125,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( @@ -143,28 +152,22 @@ async def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + api_version=api_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('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: @@ -174,9 +177,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -191,34 +194,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHostUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -231,8 +230,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 + _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,14 +255,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( @@ -274,28 +282,22 @@ async def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + api_version=api_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('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: @@ -305,11 +307,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -321,27 +323,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -351,9 +352,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -370,14 +373,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -390,25 +396,18 @@ async def begin_delete( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_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: @@ -418,10 +417,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + 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, @@ -440,7 +440,7 @@ async def get( :type host_name: str :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated - host. + host. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -452,31 +452,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -489,8 +485,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 + 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,45 +504,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -552,7 +554,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -561,7 +567,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_host_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts'} # type: ignore + list_by_host_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_galleries_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_galleries_operations.py index ae2de09d844..46898717727 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_galleries_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,33 +59,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -101,8 +101,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 + _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,14 +124,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( @@ -141,27 +149,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + api_version=api_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('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: @@ -171,9 +174,9 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}'} # type: ignore + 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( self, @@ -187,33 +190,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -226,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}'} # type: ignore + _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,14 +248,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( @@ -266,27 +273,22 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + api_version=api_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('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: @@ -296,10 +298,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}'} # type: ignore + 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, @@ -313,7 +316,7 @@ async def get( :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. :type gallery_name: str - :param select: The select expression to apply on the operation. + :param select: The select expression to apply on the operation. Default value is None. :type select: str or ~azure.mgmt.compute.v2021_07_01.models.SelectPermissions :keyword callable cls: A custom type or function that will be passed the direct response :return: Gallery, or the result of cls(response) @@ -325,30 +328,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -361,9 +360,11 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -374,28 +375,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -405,9 +403,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -421,14 +421,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -440,24 +443,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -467,10 +464,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}'} # type: ignore + 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,43 +480,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -527,7 +526,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -536,11 +539,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 + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries"} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -549,42 +554,42 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -593,7 +598,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -602,7 +611,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_application_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_application_versions_operations.py index e824f5c989f..e9f2b4f5ffc 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_application_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,35 +61,31 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -105,8 +105,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 + _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,17 +136,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( @@ -158,29 +168,22 @@ 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, + api_version=api_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: @@ -190,9 +193,9 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + 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( self, @@ -208,35 +211,31 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,8 +248,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 + _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,17 +279,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( @@ -302,29 +311,22 @@ async def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + api_version=api_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: @@ -334,10 +336,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + 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, @@ -360,7 +363,7 @@ async def get( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. :type gallery_application_version_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatusTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: GalleryApplicationVersion, or the result of cls(response) @@ -372,32 +375,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,9 +409,11 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -425,30 +426,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -458,9 +456,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -483,14 +483,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -504,26 +507,18 @@ async def begin_delete( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -533,10 +528,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + 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,46 +551,50 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -603,7 +603,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -612,7 +616,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_gallery_application.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions'} # type: ignore + list_by_gallery_application.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_applications_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_applications_operations.py index ffb0811189d..cd19cfc3fcf 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_applications_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +60,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -103,8 +103,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 + _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,14 +132,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( @@ -150,28 +159,22 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + api_version=api_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('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: @@ -181,9 +184,9 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + 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( self, @@ -198,34 +201,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,8 +237,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 + _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,14 +265,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( @@ -284,28 +292,22 @@ async def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + api_version=api_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('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: @@ -315,10 +317,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + 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,29 +349,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -381,9 +381,11 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -395,29 +397,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -427,9 +426,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -447,14 +448,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -467,25 +471,18 @@ async def begin_delete( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_application_name=gallery_application_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -495,10 +492,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + 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,45 +511,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -560,7 +561,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -569,7 +574,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications'} # type: ignore + list_by_gallery.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_image_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_image_versions_operations.py index f71f1ba39c3..97729da4853 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_image_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,35 +61,31 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -105,8 +105,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 + _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,14 +139,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( @@ -158,29 +167,22 @@ 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, + api_version=api_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: @@ -190,9 +192,9 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + 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( self, @@ -208,35 +210,31 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,8 +247,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 + _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,14 +281,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( @@ -302,29 +309,22 @@ async def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + api_version=api_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: @@ -334,10 +334,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + 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, @@ -359,7 +360,7 @@ async def get( :type gallery_image_name: str :param gallery_image_version_name: The name of the gallery image version to be retrieved. :type gallery_image_version_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatusTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: GalleryImageVersion, or the result of cls(response) @@ -371,32 +372,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,9 +406,11 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -424,30 +423,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -457,9 +453,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -481,14 +479,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -502,26 +503,18 @@ async def begin_delete( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -531,10 +524,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + 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,46 +547,50 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -601,7 +599,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -610,7 +612,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_gallery_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions'} # type: ignore + list_by_gallery_image.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_images_operations.py index e2dd6cce2b5..2ad5b2a4c10 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +60,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -103,8 +103,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 + _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,14 +131,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( @@ -149,28 +157,22 @@ async def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + api_version=api_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('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: @@ -180,9 +182,9 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + 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( self, @@ -197,34 +199,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -237,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}'} # type: ignore + _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,14 +263,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( @@ -283,28 +289,22 @@ async def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + api_version=api_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('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: @@ -314,10 +314,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + 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,29 +345,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -379,9 +377,11 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -393,29 +393,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -425,9 +422,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -445,14 +444,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -465,25 +467,18 @@ async def begin_delete( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_image_name=gallery_image_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -493,10 +488,11 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + 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,44 +508,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -558,7 +556,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -567,7 +569,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images'} # type: ignore + list_by_gallery.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_sharing_profile_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_sharing_profile_operations.py index 9d1f2793bd3..c2ef650450c 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_sharing_profile_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_gallery_sharing_profile_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,33 +57,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -97,8 +96,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 + _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,14 +118,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( @@ -136,27 +144,22 @@ async def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, sharing_update=sharing_update, + api_version=api_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('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: @@ -166,6 +169,6 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/share'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_images_operations.py index cdcbea12d16..68896c13c35 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,33 +59,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Image') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -98,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/images/{imageName}'} # type: ignore + _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,14 +120,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( @@ -137,27 +144,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + api_version=api_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('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: @@ -167,9 +169,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -183,33 +185,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImageUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -226,8 +224,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 + _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,14 +246,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( @@ -265,27 +270,22 @@ async def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + api_version=api_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('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: @@ -295,11 +295,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -310,26 +310,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -339,9 +338,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -355,14 +356,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -374,24 +378,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, image_name=image_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_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: @@ -401,10 +399,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + 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, @@ -418,7 +417,7 @@ async def get( :type resource_group_name: str :param image_name: The name of the image. :type image_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Image, or the result of cls(response) @@ -430,30 +429,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -466,8 +461,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 + 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,43 +477,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -524,7 +523,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -533,11 +536,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 + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images"} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -547,42 +552,42 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -591,7 +596,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -600,7 +609,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_log_analytics_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_log_analytics_operations.py index 419548d5029..2be71778a1a 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_log_analytics_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,32 +56,28 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RequestRateByIntervalInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -93,8 +92,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 + _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,14 +112,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( @@ -129,26 +137,22 @@ async def begin_export_request_rate_by_interval( raw_result = await self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + api_version=api_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('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: @@ -158,9 +162,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export_request_rate_by_interval.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_export_request_rate_by_interval.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval"} # type: ignore async def _export_throttled_requests_initial( self, @@ -173,32 +177,28 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ThrottledRequestsInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -213,8 +213,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 + _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,14 +233,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( @@ -249,26 +258,22 @@ async def begin_export_throttled_requests( raw_result = await self._export_throttled_requests_initial( location=location, parameters=parameters, + api_version=api_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('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: @@ -278,6 +283,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export_throttled_requests.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_operations.py index 840df1ad2e3..1dd1140ba1a 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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.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 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,39 +52,42 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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( + api_version=api_version, + 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( + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -89,7 +96,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +109,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Compute/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Compute/operations"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_proximity_placement_groups_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_proximity_placement_groups_operations.py index 97ca55d12cb..3cb6bfa80b5 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_proximity_placement_groups_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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,33 +71,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProximityPlacementGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -109,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/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + 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,33 +140,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,9 +175,12 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore - async def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -199,26 +202,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,8 +230,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + 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, @@ -244,7 +248,7 @@ async def get( :param proximity_placement_group_name: The name of the proximity placement group. :type proximity_placement_group_name: str :param include_colocation_status: includeColocationStatus=true enables fetching the colocation - status of all the resources in the proximity placement group. + status of all the resources in the proximity placement group. Default value is None. :type include_colocation_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ProximityPlacementGroup, or the result of cls(response) @@ -256,30 +260,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -292,8 +292,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 + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -301,43 +304,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -346,7 +350,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -355,11 +363,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 + 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,44 +380,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -416,7 +428,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -425,7 +441,8 @@ 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/proximityPlacementGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_resource_skus_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_resource_skus_operations.py index 7eb7e076b71..0be74dc6031 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_resource_skus_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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.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 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, filter: Optional[str] = None, @@ -50,53 +54,53 @@ def list( """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 - currently. + currently. Default value is None. :type filter: str :param include_extended_locations: To Include Extended Locations information or not in the - response. + response. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -105,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,7 +122,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_point_collections_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_point_collections_operations.py index ee26fd32be4..4e82d34d891 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_point_collections_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +47,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,33 +76,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -114,8 +115,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 + 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,33 +145,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,9 +180,11 @@ 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( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -193,28 +195,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -224,9 +223,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -241,14 +242,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -260,24 +264,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -287,10 +285,11 @@ def get_long_running_output(pipeline_response): 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/restorePointCollections/{restorePointCollectionName}'} # type: ignore + 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, @@ -305,7 +304,7 @@ async def get( :param restore_point_collection_name: The name of the restore point collection. :type restore_point_collection_name: str :param expand: The expand expression to apply on the operation. If expand=restorePoints, server - will return all contained restore points in the restorePointCollection. + will return all contained restore points in the restorePointCollection. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionExpandOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: RestorePointCollection, or the result of cls(response) @@ -317,30 +316,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -353,8 +348,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 + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace def list( self, resource_group_name: str, @@ -365,44 +363,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -411,7 +411,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -420,11 +424,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 + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -434,43 +440,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -479,7 +486,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -488,7 +499,8 @@ 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/restorePointCollections'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_points_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_points_operations.py index e674eb222e9..afeffc3397e 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_points_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +58,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -95,8 +94,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 + _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,14 +120,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( @@ -139,28 +146,22 @@ async def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + api_version=api_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('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: @@ -170,11 +171,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -186,29 +187,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -218,9 +216,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -237,14 +237,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -257,25 +260,18 @@ async def begin_delete( resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -285,10 +281,11 @@ def get_long_running_output(pipeline_response): 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/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + 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,29 +311,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,4 +343,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_galleries_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_galleries_operations.py index c42364e8142..68b716a2202 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_galleries_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,49 +57,50 @@ def list( :param location: Resource location. :type location: str :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. + listing operations. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -103,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,11 +122,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 + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries"} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -139,28 +151,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,4 +182,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_image_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_image_versions_operations.py index b5b204f2ff1..e70e9d3895a 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_image_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -59,51 +64,55 @@ def list( Versions are to be listed. :type gallery_image_name: str :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. + listing operations. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -112,7 +121,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -121,11 +134,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 + 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,30 +173,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,4 +206,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_images_operations.py index 93eb9499fde..42f08e0f27c 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_shared_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -55,50 +60,53 @@ def list( :param gallery_unique_name: The unique name of the Shared Gallery. :type gallery_unique_name: str :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. + listing operations. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -107,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -116,11 +128,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 + 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,29 +161,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -182,4 +193,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_ssh_public_keys_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_ssh_public_keys_operations.py index 660fd6f2667..fb0a4867909 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_ssh_public_keys_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +45,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,43 +54,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -94,7 +100,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,11 +113,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 + 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,44 +131,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -165,7 +179,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,11 +192,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 + 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,33 +224,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SshPublicKeyResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -247,8 +263,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 + 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,33 +293,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -313,9 +328,12 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore - async def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -337,26 +355,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -366,8 +383,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + 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,28 +409,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -424,8 +440,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 + 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,28 +469,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,4 +500,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 + + generate_key_pair.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_usage_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_usage_operations.py index 3edc8929784..ae49b5adfdc 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_usage_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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.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 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,43 +57,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -98,7 +103,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +116,8 @@ 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}/usages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extension_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extension_images_operations.py index 95f503f8326..54284f5251a 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extension_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +43,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,30 +72,27 @@ 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') - - # 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) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,8 +105,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 + 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,28 +132,25 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -162,8 +163,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 + 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, @@ -182,11 +186,11 @@ async def list_versions( :type publisher_name: str :param type: :type type: str - :param filter: The filter to apply on the operation. + :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :param top: + :param top: Default value is None. :type top: int - :param orderby: + :param orderby: Default value is None. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineExtensionImage, or the result of cls(response) @@ -198,35 +202,29 @@ 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,4 +237,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 + + list_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extensions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extensions_operations.py index 3f7fbe8b9c7..bd57951736f 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extensions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +58,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -99,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/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + _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,14 +125,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( @@ -144,28 +152,22 @@ async def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -175,9 +177,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,34 +194,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,8 +230,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 + _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,17 +253,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( @@ -276,28 +284,22 @@ async def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -307,11 +309,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -323,27 +325,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -353,9 +354,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -372,14 +375,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -392,25 +398,18 @@ async def begin_delete( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -420,10 +419,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + 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, @@ -440,7 +440,7 @@ async def get( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineExtension, or the result of cls(response) @@ -452,31 +452,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -489,8 +485,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 + 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, @@ -504,7 +503,7 @@ async def list( :type resource_group_name: str :param vm_name: The name of the virtual machine containing the extension. :type vm_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineExtensionsListResult, or the result of cls(response) @@ -516,30 +515,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -552,4 +547,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 + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_edge_zone_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_edge_zone_operations.py index 9eee834806d..8c2c5df7f22 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +43,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,32 +78,29 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,8 +113,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 + 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, @@ -139,12 +143,13 @@ async def list( :type offer: str :param skus: A valid image SKU. :type skus: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :param top: An integer value specifying the number of images to return that matches supplied - values. + values. Default value is None. :type top: int :param orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineImageResource, or the result of cls(response) @@ -156,37 +161,31 @@ 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -199,8 +198,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 + 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,29 +229,26 @@ 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') - - # 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) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -262,8 +261,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 + 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,28 +288,25 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -320,8 +319,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 + 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,30 +353,27 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -387,4 +386,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 + + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_operations.py index 639ecf2de94..ccfa60dd52f 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +43,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,31 +75,28 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +109,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 + 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, @@ -132,11 +136,11 @@ async def list( :type offer: str :param skus: A valid image SKU. :type skus: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str - :param top: + :param top: Default value is None. :type top: int - :param orderby: + :param orderby: Default value is None. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineImageResource, or the result of cls(response) @@ -148,36 +152,30 @@ 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -190,8 +188,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 + 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,28 +215,25 @@ 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') - - # 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) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -248,8 +246,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 + 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,27 +270,24 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -302,8 +300,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 + 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,29 +330,26 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -364,4 +362,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 + + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_run_commands_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_run_commands_operations.py index 25bca6d48e9..13debd18011 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_run_commands_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,44 +58,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -99,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,11 +119,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 + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands"} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -135,28 +148,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -169,7 +179,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}"} # type: ignore + async def _create_or_update_initial( self, @@ -177,6 +189,8 @@ async def _create_or_update_initial( vm_name: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommand", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.VirtualMachineRunCommand": cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] @@ -184,34 +198,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -228,14 +237,19 @@ 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 + _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, vm_name: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommand", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. @@ -249,16 +263,24 @@ async def begin_create_or_update( :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -272,28 +294,22 @@ async def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -303,9 +319,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -313,6 +329,8 @@ async def _update_initial( vm_name: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommandUpdate", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.VirtualMachineRunCommand": cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] @@ -320,34 +338,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -360,14 +373,19 @@ 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 + _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, vm_name: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommandUpdate", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. @@ -380,16 +398,24 @@ async def begin_update( :type run_command_name: str :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandUpdate + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -403,28 +429,22 @@ async def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -434,11 +454,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -450,29 +470,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -482,9 +499,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -501,14 +520,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -521,25 +543,18 @@ async def begin_delete( resource_group_name=resource_group_name, vm_name=vm_name, run_command_name=run_command_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -549,10 +564,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + 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, @@ -569,7 +585,7 @@ async def get_by_virtual_machine( :type vm_name: str :param run_command_name: The name of the virtual machine run command. :type run_command_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineRunCommand, or the result of cls(response) @@ -581,31 +597,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -618,8 +630,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 + 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, @@ -633,50 +648,53 @@ def list_by_virtual_machine( :type resource_group_name: str :param vm_name: The name of the virtual machine containing the run command. :type vm_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -685,7 +703,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,7 +716,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands'} # type: ignore + list_by_virtual_machine.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 11d1321e10f..db4a0bc1ffa 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,34 +60,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -100,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/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + _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,17 +124,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( @@ -145,28 +155,22 @@ async def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -176,9 +180,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -193,34 +197,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -237,8 +237,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 + _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,17 +260,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( @@ -281,28 +291,22 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -312,11 +316,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,27 +332,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -358,9 +361,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -377,14 +382,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -397,25 +405,18 @@ async def begin_delete( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - '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: @@ -425,10 +426,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + 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, @@ -445,7 +447,7 @@ async def get( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. :type vmss_extension_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetExtension, or the result of cls(response) @@ -457,31 +459,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -494,8 +492,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 + 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,45 +510,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -556,7 +560,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,7 +573,8 @@ 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/{vmScaleSetName}/extensions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 9a80b294eea..7e79a289d93 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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]] @@ -42,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _cancel_initial( + async def _cancel_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -53,26 +56,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -82,9 +84,11 @@ async def _cancel_initial( if cls: return cls(pipeline_response, None, {}) - _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + _cancel_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def begin_cancel( + + @distributed_trace_async + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -98,14 +102,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -117,24 +124,18 @@ async def begin_cancel( raw_result = await self._cancel_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -144,11 +145,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _start_os_upgrade_initial( + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore + + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -159,26 +160,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -188,9 +188,11 @@ async def _start_os_upgrade_initial( if cls: return cls(pipeline_response, None, {}) - _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + _start_os_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - async def begin_start_os_upgrade( + + @distributed_trace_async + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -206,14 +208,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -225,24 +230,18 @@ async def begin_start_os_upgrade( raw_result = await self._start_os_upgrade_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -252,11 +251,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_os_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + 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( + async def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -267,26 +266,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -296,9 +294,11 @@ async def _start_extension_upgrade_initial( if cls: return cls(pipeline_response, None, {}) - _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + _start_extension_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore + - async def begin_start_extension_upgrade( + @distributed_trace_async + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -314,14 +314,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -333,24 +336,18 @@ async def begin_start_extension_upgrade( raw_result = await self._start_extension_upgrade_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -360,10 +357,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_extension_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + 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,28 +384,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -420,4 +415,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 + + get_latest.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 4ca18857a97..c64a50721a0 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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,35 +59,31 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -101,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/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + _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,17 +126,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( @@ -149,29 +158,22 @@ async def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -181,9 +183,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -199,35 +201,31 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -240,8 +238,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 + _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,17 +264,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( @@ -288,29 +296,22 @@ async def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -320,11 +321,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -337,30 +338,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -370,9 +368,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -392,14 +392,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -413,26 +416,18 @@ async def begin_delete( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_extension_name=vm_extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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: @@ -442,10 +437,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + 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, @@ -465,7 +461,7 @@ async def get( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVMExtension, or the result of cls(response) @@ -477,32 +473,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -515,8 +507,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 + 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, @@ -533,7 +528,7 @@ async def list( :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. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVMExtensionsListResult, or the result of cls(response) @@ -545,31 +540,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -582,4 +573,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 + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 0fa80cba341..ce88e6216c8 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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]] @@ -50,6 +54,8 @@ async def _create_or_update_initial( instance_id: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommand", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.VirtualMachineRunCommand": cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] @@ -57,35 +63,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -102,8 +103,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 + _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, @@ -111,6 +115,8 @@ async def begin_create_or_update( instance_id: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommand", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the VMSS VM run command. @@ -125,16 +131,24 @@ async def begin_create_or_update( :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -149,29 +163,22 @@ async def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -181,9 +188,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -192,6 +199,8 @@ async def _update_initial( instance_id: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommandUpdate", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> "_models.VirtualMachineRunCommand": cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] @@ -199,35 +208,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -240,8 +244,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 + _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, @@ -249,6 +256,8 @@ async def begin_update( instance_id: str, run_command_name: str, run_command: "_models.VirtualMachineRunCommandUpdate", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. @@ -263,16 +272,24 @@ async def begin_update( :type run_command_name: str :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandUpdate + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -287,29 +304,22 @@ async def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -319,11 +329,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,30 +346,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -369,9 +376,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -391,14 +400,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -412,26 +424,18 @@ async def begin_delete( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, run_command_name=run_command_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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: @@ -441,10 +445,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + 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, @@ -464,7 +469,7 @@ async def get( :type instance_id: str :param run_command_name: The name of the virtual machine run command. :type run_command_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineRunCommand, or the result of cls(response) @@ -476,32 +481,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -514,8 +515,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 + 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, @@ -532,51 +536,55 @@ def list( :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. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -585,7 +593,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,7 +606,8 @@ 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/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vms_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vms_operations.py index 7aded4f51d5..69c73bc0f34 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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]] -class VirtualMachineScaleSetVMsOperations: +class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods """VirtualMachineScaleSetVMsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -43,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _reimage_initial( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -56,35 +60,33 @@ 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -94,9 +96,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore + - async def begin_reimage( + @distributed_trace_async + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -113,17 +117,23 @@ 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 + Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -137,25 +147,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -165,11 +169,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + 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( + async def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -181,27 +185,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -211,9 +214,11 @@ async def _reimage_all_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore - async def begin_reimage_all( + + @distributed_trace_async + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -231,14 +236,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -251,25 +259,18 @@ async def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -279,11 +280,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + 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( + async def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -295,27 +296,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -325,9 +325,11 @@ async def _deallocate_initial( if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore - async def begin_deallocate( + + @distributed_trace_async + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,14 +348,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -366,25 +371,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -394,9 +392,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -411,34 +409,30 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -455,8 +449,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 + _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,14 +475,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( @@ -499,28 +502,22 @@ async def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + api_version=api_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('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: @@ -530,11 +527,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -547,29 +544,27 @@ 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] + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -579,9 +574,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -598,18 +595,21 @@ async def begin_delete( :param instance_id: The instance ID of the virtual machine. :type instance_id: str :param force_deletion: Optional parameter to force delete a virtual machine from a VM scale - set. (Feature in Preview). + set. (Feature in Preview). Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -623,25 +623,18 @@ async def begin_delete( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, force_deletion=force_deletion, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -651,10 +644,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + 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, @@ -673,7 +667,7 @@ async def get( :type instance_id: str :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual - machine. + machine. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -685,31 +679,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -722,8 +712,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 + 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,29 +742,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -784,8 +774,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 + 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, @@ -803,59 +796,63 @@ def list( :type virtual_machine_scale_set_name: str :param filter: The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied - eq true', 'properties/latestModelApplied eq false'. + eq true', 'properties/latestModelApplied eq false'. Default value is None. :type filter: str :param select: The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + Default value is None. :type select: str :param expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. + 'instanceView'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -864,7 +861,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -873,12 +874,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/{virtualMachineScaleSetName}/virtualMachines'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines"} # type: ignore - async def _power_off_initial( + async def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -891,29 +893,27 @@ 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] + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -923,9 +923,11 @@ async def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore - async def begin_power_off( + + @distributed_trace_async + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -945,18 +947,21 @@ async def begin_power_off( :type instance_id: str :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. + flag is false if not specified. Default value is False. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -970,25 +975,18 @@ async def begin_power_off( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, skip_shutdown=skip_shutdown, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,11 +996,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _restart_initial( + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1014,27 +1012,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1044,9 +1041,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore + - async def begin_restart( + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1063,14 +1062,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1083,25 +1085,18 @@ async def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,11 +1106,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _start_initial( + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1127,27 +1122,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1157,9 +1151,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore + - async def begin_start( + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1176,14 +1172,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1196,25 +1195,18 @@ async def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,11 +1216,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _redeploy_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore + + async def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1240,27 +1232,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1270,9 +1261,11 @@ async def _redeploy_initial( if cls: return cls(pipeline_response, None, {}) - _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore + - async def begin_redeploy( + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1290,14 +1283,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1310,25 +1306,18 @@ async def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,10 +1327,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + 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, @@ -1361,7 +1351,7 @@ async def retrieve_boot_diagnostics_data( :type instance_id: str :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. :code:`
`:code:`
`NOTE: If not specified, SAS URIs - will be generated with a default expiration duration of 120 minutes. + will be generated with a default expiration duration of 120 minutes. Default value is None. :type sas_uri_expiration_time_in_minutes: int :keyword callable cls: A custom type or function that will be passed the direct response :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) @@ -1373,31 +1363,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1410,9 +1396,11 @@ 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( + 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( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1424,27 +1412,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1454,9 +1441,11 @@ async def _perform_maintenance_initial( if cls: return cls(pipeline_response, None, {}) - _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore + - async def begin_perform_maintenance( + @distributed_trace_async + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1473,14 +1462,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1493,25 +1485,18 @@ async def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,11 +1506,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore - async def simulate_eviction( + @distributed_trace_async + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1550,27 +1536,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1580,7 +1565,8 @@ async def simulate_eviction( if cls: return cls(pipeline_response, None, {}) - simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction'} # type: ignore + simulate_eviction.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction"} # type: ignore + async def _run_command_initial( self, @@ -1588,6 +1574,8 @@ async def _run_command_initial( vm_scale_set_name: str, instance_id: str, parameters: "_models.RunCommandInput", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> Optional["_models.RunCommandResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] @@ -1595,34 +1583,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RunCommandInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1637,14 +1620,19 @@ 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 + _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, vm_scale_set_name: str, instance_id: str, parameters: "_models.RunCommandInput", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.RunCommandResult"]: """Run command on a virtual machine in a VM scale set. @@ -1657,16 +1645,24 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_07_01.models.RunCommandInput + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( @@ -1680,28 +1676,22 @@ async def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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,6 +1701,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_sets_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_sets_operations.py index b5875714147..67b9cca69f8 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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]] -class VirtualMachineScaleSetsOperations: +class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods """VirtualMachineScaleSetsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -43,6 +47,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,44 +58,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -99,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,10 +119,11 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets'} # type: ignore + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets"} # type: ignore async def _create_or_update_initial( self, @@ -125,33 +137,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineScaleSet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -168,8 +176,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 + _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,14 +198,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( @@ -207,27 +224,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + api_version=api_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('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: @@ -237,9 +249,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -253,33 +265,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -292,8 +300,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 + _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,14 +322,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( @@ -331,27 +348,22 @@ async def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + api_version=api_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('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: @@ -361,11 +373,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -377,28 +389,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -408,9 +418,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -424,17 +436,21 @@ async def begin_delete( :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str :param force_deletion: Optional parameter to force delete a VM scale set. (Feature in Preview). + Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -447,24 +463,18 @@ async def begin_delete( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, force_deletion=force_deletion, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -474,10 +484,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + 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, @@ -493,7 +504,7 @@ async def get( :type vm_scale_set_name: str :param expand: The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set - Create/Update operation. + Create/Update operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetVMScaleSets :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSet, or the result of cls(response) @@ -505,30 +516,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,9 +548,11 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + async def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -555,34 +564,32 @@ 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -592,9 +599,11 @@ async def _deallocate_initial( if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore - async def begin_deallocate( + + @distributed_trace_async + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -609,18 +618,24 @@ async def begin_deallocate( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -633,24 +648,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -660,11 +670,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + 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( + async def _delete_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -677,33 +687,30 @@ 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -713,9 +720,11 @@ async def _delete_instances_initial( if cls: return cls(pipeline_response, None, {}) - _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore - async def begin_delete_instances( + + @distributed_trace_async + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -730,20 +739,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). + set. (Feature in Preview). Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -757,24 +771,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -784,10 +793,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + 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,28 +820,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -844,8 +851,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 + 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,44 +866,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -902,7 +914,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -911,11 +927,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 + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets"} # type: ignore + @distributed_trace def list_all( self, **kwargs: Any @@ -925,43 +943,44 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -970,7 +989,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -979,11 +1002,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 + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets"} # type: ignore + @distributed_trace def list_skus( self, resource_group_name: str, @@ -998,45 +1023,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -1045,7 +1073,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1054,11 +1086,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 + 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,45 +1106,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -1119,7 +1156,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1128,12 +1169,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - get_os_upgrade_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory'} # type: ignore + get_os_upgrade_history.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory"} # type: ignore - async def _power_off_initial( + async def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1146,36 +1188,33 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1185,9 +1224,11 @@ async def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - async def begin_power_off( + + @distributed_trace_async + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1205,20 +1246,26 @@ async def begin_power_off( :type vm_scale_set_name: str :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. + flag is false if not specified. Default value is False. :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 + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1232,24 +1279,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1259,11 +1301,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + 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( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1275,34 +1317,32 @@ 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1312,9 +1352,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - async def begin_restart( + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1327,18 +1369,24 @@ async def begin_restart( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1351,24 +1399,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1378,11 +1421,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + 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( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1394,34 +1437,32 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1431,9 +1472,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - async def begin_start( + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1446,18 +1489,24 @@ async def begin_start( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1470,24 +1519,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1497,11 +1541,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + 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( + async def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1513,34 +1557,32 @@ 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1550,9 +1592,11 @@ async def _redeploy_initial( if cls: return cls(pipeline_response, None, {}) - _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore + - async def begin_redeploy( + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1566,18 +1610,24 @@ async def begin_redeploy( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1590,24 +1640,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1617,11 +1662,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _perform_maintenance_initial( + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore + + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1633,34 +1678,32 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1670,9 +1713,11 @@ async def _perform_maintenance_initial( if cls: return cls(pipeline_response, None, {}) - _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore + - async def begin_perform_maintenance( + @distributed_trace_async + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1688,18 +1733,24 @@ async def begin_perform_maintenance( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1712,24 +1763,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1739,11 +1785,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _update_instances_initial( + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore + + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1755,31 +1801,29 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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') - 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) + 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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1789,9 +1833,11 @@ async def _update_instances_initial( if cls: return cls(pipeline_response, None, {}) - _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + _update_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore - async def begin_update_instances( + + @distributed_trace_async + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1805,17 +1851,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1828,24 +1879,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1855,11 +1901,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + 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( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1871,34 +1917,32 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1908,9 +1952,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - async def begin_reimage( + + @distributed_trace_async + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1925,18 +1971,23 @@ async def begin_reimage( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. - :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetReimageParameters + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1949,24 +2000,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1976,11 +2022,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _reimage_all_initial( + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore + + async def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1992,34 +2038,32 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2029,9 +2073,11 @@ async def _reimage_all_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore + - async def begin_reimage_all( + @distributed_trace_async + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2045,18 +2091,24 @@ async def begin_reimage_all( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2069,24 +2121,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -2096,10 +2143,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + 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,29 +2175,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2162,9 +2207,12 @@ 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 - async def convert_to_single_placement_group( + 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( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2178,7 +2226,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,31 +2238,29 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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') - 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) + 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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2223,9 +2270,10 @@ async def convert_to_single_placement_group( if cls: return cls(pipeline_response, None, {}) - convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + 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( + async def _set_orchestration_service_state_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2237,31 +2285,29 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2271,9 +2317,11 @@ async def _set_orchestration_service_state_initial( if cls: return cls(pipeline_response, None, {}) - _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + _set_orchestration_service_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore + - async def begin_set_orchestration_service_state( + @distributed_trace_async + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2290,14 +2338,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2310,24 +2362,19 @@ async def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -2337,6 +2384,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_orchestration_service_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_sizes_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_sizes_operations.py index 736fcf58706..ce51b109367 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_sizes_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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.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 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -52,44 +56,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -98,7 +104,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +117,8 @@ 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}/vmSizes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machines_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machines_operations.py index 7fd17df1ccf..a756a259979 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machines_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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]] -class VirtualMachinesOperations: +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods """VirtualMachinesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -43,6 +47,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,44 +58,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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) @@ -99,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,10 +119,11 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'} # type: ignore + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines"} # type: ignore async def _capture_initial( self, @@ -125,33 +137,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -166,8 +174,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 + _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,14 +197,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( @@ -206,27 +223,22 @@ async def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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('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: @@ -236,9 +248,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -252,33 +264,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachine') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -295,8 +303,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 + _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,14 +326,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( @@ -335,27 +352,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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('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: @@ -365,9 +377,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -381,33 +393,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -420,8 +428,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 + _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,14 +450,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( @@ -459,27 +476,22 @@ async def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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('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: @@ -489,11 +501,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + 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( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -505,28 +517,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -536,9 +546,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -551,18 +563,22 @@ 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. + :param force_deletion: Optional parameter to force delete virtual machines. Default value is + None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -575,24 +591,18 @@ async def begin_delete( resource_group_name=resource_group_name, vm_name=vm_name, force_deletion=force_deletion, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -602,10 +612,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + 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, @@ -623,6 +634,7 @@ async def get( snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. + Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -634,30 +646,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -670,8 +678,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 + 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, @@ -694,28 +705,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -728,9 +736,11 @@ 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( + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore + + + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -741,26 +751,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -770,9 +779,11 @@ async def _convert_to_managed_disks_initial( if cls: return cls(pipeline_response, None, {}) - _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + _convert_to_managed_disks_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore - async def begin_convert_to_managed_disks( + + @distributed_trace_async + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -787,14 +798,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -806,24 +820,18 @@ async def begin_convert_to_managed_disks( raw_result = await self._convert_to_managed_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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,11 +841,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_convert_to_managed_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + 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( + async def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -849,28 +857,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -880,9 +886,11 @@ async def _deallocate_initial( if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore + - async def begin_deallocate( + @distributed_trace_async + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -897,17 +905,21 @@ async def begin_deallocate( :param vm_name: The name of the virtual machine. :type vm_name: str :param hibernate: Optional parameter to hibernate a virtual machine. (Feature in Preview). + Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -920,24 +932,18 @@ async def begin_deallocate( resource_group_name=resource_group_name, vm_name=vm_name, hibernate=hibernate, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -947,11 +953,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore - async def generalize( + @distributed_trace_async + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -978,26 +985,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1007,8 +1013,10 @@ async def generalize( if cls: return cls(pipeline_response, None, {}) - generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + generalize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -1020,44 +1028,46 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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,7 +1076,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1075,11 +1089,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 + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines"} # type: ignore + @distributed_trace def list_all( self, status_only: Optional[str] = None, @@ -1089,48 +1105,49 @@ def list_all( the response to get the next page of virtual machines. :param status_only: statusOnly=true enables fetching run time status of all Virtual Machines in - the subscription. + the subscription. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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,7 +1156,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1148,11 +1169,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 + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines"} # type: ignore + @distributed_trace def list_available_sizes( self, resource_group_name: str, @@ -1167,45 +1190,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _convert_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,7 +1240,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1223,12 +1253,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes'} # type: ignore + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes"} # type: ignore - async def _power_off_initial( + async def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1240,28 +1271,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1271,9 +1300,11 @@ async def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore + - async def begin_power_off( + @distributed_trace_async + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1289,18 +1320,21 @@ async def begin_power_off( :type vm_name: str :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. + flag is false if not specified. Default value is False. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1313,24 +1347,18 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_name=vm_name, skip_shutdown=skip_shutdown, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1340,11 +1368,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _reapply_initial( + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore + + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1355,28 +1383,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1386,9 +1411,11 @@ async def _reapply_initial( if cls: return cls(pipeline_response, None, {}) - _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + _reapply_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def begin_reapply( + + @distributed_trace_async + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1402,14 +1429,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1421,24 +1451,18 @@ async def begin_reapply( raw_result = await self._reapply_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1448,11 +1472,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reapply.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _restart_initial( + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1463,26 +1487,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1492,9 +1515,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - async def begin_restart( + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1508,14 +1533,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1527,24 +1555,18 @@ async def begin_restart( raw_result = await self._restart_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1554,11 +1576,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + 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( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1569,26 +1591,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1598,9 +1619,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - async def begin_start( + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1614,14 +1637,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1633,24 +1659,18 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1660,11 +1680,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + 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( + async def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1675,26 +1695,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1704,9 +1723,11 @@ async def _redeploy_initial( if cls: return cls(pipeline_response, None, {}) - _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore + - async def begin_redeploy( + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1720,14 +1741,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1739,24 +1763,18 @@ async def begin_redeploy( raw_result = await self._redeploy_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1766,11 +1784,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + 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( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1782,34 +1800,32 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1819,9 +1835,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore + - async def begin_reimage( + @distributed_trace_async + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1834,18 +1852,23 @@ async def begin_reimage( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1858,24 +1881,19 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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): if cls: return cls(pipeline_response, 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: @@ -1885,10 +1903,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + 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, @@ -1904,7 +1923,7 @@ async def retrieve_boot_diagnostics_data( :type vm_name: str :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. :code:`
`:code:`
`NOTE: If not specified, SAS URIs - will be generated with a default expiration duration of 120 minutes. + will be generated with a default expiration duration of 120 minutes. Default value is None. :type sas_uri_expiration_time_in_minutes: int :keyword callable cls: A custom type or function that will be passed the direct response :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) @@ -1916,30 +1935,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1952,9 +1967,11 @@ 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( + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore + + + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1965,26 +1982,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1994,9 +2010,11 @@ async def _perform_maintenance_initial( if cls: return cls(pipeline_response, None, {}) - _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + - async def begin_perform_maintenance( + @distributed_trace_async + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2010,14 +2028,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2029,24 +2050,18 @@ async def begin_perform_maintenance( raw_result = await self._perform_maintenance_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -2056,11 +2071,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def simulate_eviction( + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + + @distributed_trace_async + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2082,26 +2098,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -2111,7 +2126,8 @@ async def simulate_eviction( if cls: return cls(pipeline_response, None, {}) - simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'} # type: ignore + simulate_eviction.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction"} # type: ignore + async def _assess_patches_initial( self, @@ -2124,28 +2140,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2160,8 +2173,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 + _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, @@ -2176,14 +2192,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( @@ -2195,27 +2216,21 @@ async def begin_assess_patches( raw_result = await self._assess_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -2225,9 +2240,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_assess_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore async def _install_patches_initial( self, @@ -2241,33 +2256,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') + + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2282,8 +2293,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 + _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, @@ -2298,17 +2312,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( @@ -2321,27 +2342,22 @@ async def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + api_version=api_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('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: @@ -2351,15 +2367,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_install_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_install_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches"} # type: ignore async def _run_command_initial( self, resource_group_name: str, vm_name: str, parameters: "_models.RunCommandInput", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> Optional["_models.RunCommandResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] @@ -2367,33 +2385,28 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RunCommandInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2408,13 +2421,18 @@ 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 + _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, vm_name: str, parameters: "_models.RunCommandInput", + *, + content_type: Optional[str] = "application/json", **kwargs: Any ) -> AsyncLROPoller["_models.RunCommandResult"]: """Run command on the VM. @@ -2425,16 +2443,24 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_07_01.models.RunCommandInput + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( @@ -2447,27 +2473,22 @@ async def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -2477,6 +2498,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/__init__.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/__init__.py index dfe54ae2b59..ab409e87968 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/__init__.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/__init__.py @@ -6,634 +6,321 @@ # 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 CommunityGalleryDataDiskImage - from ._models_py3 import CommunityGalleryDiskImage - from ._models_py3 import CommunityGalleryImage - from ._models_py3 import CommunityGalleryImageList - from ._models_py3 import CommunityGalleryImageVersion - from ._models_py3 import CommunityGalleryImageVersionList - from ._models_py3 import CommunityGalleryImageVersionStorageProfile - from ._models_py3 import CommunityGalleryInfo - from ._models_py3 import CommunityGalleryOSDiskImage - 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 RegionalSharingStatus - 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 SharingStatus - 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 CommunityGalleryDataDiskImage # type: ignore - from ._models import CommunityGalleryDiskImage # type: ignore - from ._models import CommunityGalleryImage # type: ignore - from ._models import CommunityGalleryImageList # type: ignore - from ._models import CommunityGalleryImageVersion # type: ignore - from ._models import CommunityGalleryImageVersionList # type: ignore - from ._models import CommunityGalleryImageVersionStorageProfile # type: ignore - from ._models import CommunityGalleryInfo # type: ignore - from ._models import CommunityGalleryOSDiskImage # 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 RegionalSharingStatus # 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 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 SharingStatus # 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 CommunityGalleryDataDiskImage +from ._models_py3 import CommunityGalleryDiskImage +from ._models_py3 import CommunityGalleryImage +from ._models_py3 import CommunityGalleryImageList +from ._models_py3 import CommunityGalleryImageVersion +from ._models_py3 import CommunityGalleryImageVersionList +from ._models_py3 import CommunityGalleryImageVersionStorageProfile +from ._models_py3 import CommunityGalleryInfo +from ._models_py3 import CommunityGalleryOSDiskImage +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 OSDiskImageSecurityProfile +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 RegionalSharingStatus +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 SharingStatus +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, @@ -696,6 +383,7 @@ RestorePointCollectionExpandOptions, RollingUpgradeActionType, RollingUpgradeStatusCode, + SecurityProfileType, SecurityTypes, SelectPermissions, SettingNames, @@ -845,6 +533,7 @@ 'OSDisk', 'OSDiskImage', 'OSDiskImageEncryption', + 'OSDiskImageSecurityProfile', 'OSProfile', 'OrchestrationServiceStateInput', 'OrchestrationServiceSummary', @@ -1098,6 +787,7 @@ 'RestorePointCollectionExpandOptions', 'RollingUpgradeActionType', 'RollingUpgradeStatusCode', + 'SecurityProfileType', 'SecurityTypes', 'SelectPermissions', 'SettingNames', diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_compute_management_client_enums.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_compute_management_client_enums.py index 597c8593dac..476ff4fa5e7 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_compute_management_client_enums.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/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,15 +208,17 @@ 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** + :code:`
`:code:`
` **Community** """ PRIVATE = "Private" GROUPS = "Groups" + COMMUNITY = "Community" -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 +226,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 +261,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 +270,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 +279,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 +290,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 +302,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 +311,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 +327,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 +363,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 +388,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 +400,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 +408,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 +417,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 +446,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 +455,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 +470,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 +478,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 +512,15 @@ class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu COMPLETED = "Completed" FAULTED = "Faulted" -class SecurityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityProfileType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """all types of security profile + """ + + ENCRYPTED_VM_GUEST_STATE_ONLY_WITH_PMK = "EncryptedVMGuestStateOnlyWithPmk" + ENCRYPTED_WITH_PMK = "EncryptedWithPmk" + ENCRYPTED_WITH_CMK = "EncryptedWithCmk" + +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 +528,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,21 +540,20 @@ 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** :code:`
`:code:`
` **Community** + **AADTenants** """ SUBSCRIPTIONS = "Subscriptions" AAD_TENANTS = "AADTenants" - COMMUNITY = "Community" -class SharingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SharingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The sharing state of the gallery, which only appears in the response. """ @@ -568,7 +562,7 @@ class SharingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" UNKNOWN = "Unknown" -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** @@ -579,7 +573,7 @@ class SharingUpdateOperationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, RESET = "Reset" ENABLE_COMMUNITY = "EnableCommunity" -class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -587,7 +581,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. """ @@ -596,7 +590,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 @@ -614,7 +608,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 @@ -626,7 +620,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 """ @@ -634,7 +628,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. """ @@ -643,14 +637,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. @@ -660,20 +654,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: @@ -855,20 +849,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" @@ -879,7 +873,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. """ @@ -888,7 +882,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. """ @@ -896,7 +890,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. """ @@ -907,7 +901,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:`
` @@ -918,7 +912,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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models.py deleted file mode 100644 index 6c93de3d1fc..00000000000 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models.py +++ /dev/null @@ -1,13355 +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 CommunityGalleryDiskImage(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 - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryDiskImage, self).__init__(**kwargs) - self.size_in_gb = None - self.host_caching = kwargs.get('host_caching', None) - - -class CommunityGalleryDataDiskImage(CommunityGalleryDiskImage): - """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 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'}, - 'lun': {'key': 'lun', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryDataDiskImage, self).__init__(**kwargs) - self.lun = kwargs['lun'] - - -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 CommunityGalleryImageList(msrest.serialization.Model): - """The List Community Gallery Images operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of community gallery images. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImage] - :param next_link: The uri to fetch the next page of community gallery images. Call ListNext() - with this to fetch the next page of community gallery images. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CommunityGalleryImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryImageList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', 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 - :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 - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: - ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionStorageProfile - """ - - _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'}, - 'exclude_from_latest': {'key': 'properties.excludeFromLatest', 'type': 'bool'}, - 'storage_profile': {'key': 'properties.storageProfile', 'type': 'CommunityGalleryImageVersionStorageProfile'}, - } - - 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) - self.exclude_from_latest = kwargs.get('exclude_from_latest', None) - self.storage_profile = kwargs.get('storage_profile', None) - - -class CommunityGalleryImageVersionList(msrest.serialization.Model): - """The List Community Gallery Image versions operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of community gallery image versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersion] - :param next_link: The uri to fetch the next page of community gallery image versions. Call - ListNext() with this to fetch the next page of community gallery image versions. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CommunityGalleryImageVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryImageVersionList, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class CommunityGalleryImageVersionStorageProfile(msrest.serialization.Model): - """This is the storage profile of a Gallery Image Version. - - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: - list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryDataDiskImage] - """ - - _attribute_map = { - 'os_disk_image': {'key': 'osDiskImage', 'type': 'CommunityGalleryOSDiskImage'}, - 'data_disk_images': {'key': 'dataDiskImages', 'type': '[CommunityGalleryDataDiskImage]'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryImageVersionStorageProfile, self).__init__(**kwargs) - self.os_disk_image = kwargs.get('os_disk_image', None) - self.data_disk_images = kwargs.get('data_disk_images', None) - - -class CommunityGalleryInfo(msrest.serialization.Model): - """Information of community gallery if current gallery is shared to community. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param publisher_uri: Community gallery publisher uri. - :type publisher_uri: str - :param publisher_contact: Community gallery publisher contact email. - :type publisher_contact: str - :param eula: Community gallery publisher eula. - :type eula: str - :param public_name_prefix: Community gallery public name prefix. - :type public_name_prefix: str - :ivar community_gallery_enabled: Contains info about whether community gallery sharing is - enabled. - :vartype community_gallery_enabled: bool - :ivar public_names: Community gallery public name list. - :vartype public_names: list[str] - """ - - _validation = { - 'community_gallery_enabled': {'readonly': True}, - 'public_names': {'readonly': True}, - } - - _attribute_map = { - 'publisher_uri': {'key': 'publisherUri', 'type': 'str'}, - 'publisher_contact': {'key': 'publisherContact', 'type': 'str'}, - 'eula': {'key': 'eula', 'type': 'str'}, - 'public_name_prefix': {'key': 'publicNamePrefix', 'type': 'str'}, - 'community_gallery_enabled': {'key': 'communityGalleryEnabled', 'type': 'bool'}, - 'public_names': {'key': 'publicNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryInfo, self).__init__(**kwargs) - self.publisher_uri = kwargs.get('publisher_uri', None) - self.publisher_contact = kwargs.get('publisher_contact', None) - self.eula = kwargs.get('eula', None) - self.public_name_prefix = kwargs.get('public_name_prefix', None) - self.community_gallery_enabled = None - self.public_names = None - - -class CommunityGalleryOSDiskImage(CommunityGalleryDiskImage): - """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 - """ - - _validation = { - 'size_in_gb': {'readonly': True}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'host_caching': {'key': 'hostCaching', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunityGalleryOSDiskImage, self).__init__(**kwargs) - - -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:`
`\ **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. - :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 - :ivar sharing_status: Sharing status of current gallery. - :vartype sharing_status: ~azure.mgmt.compute.v2021_07_01.models.SharingStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'sharing_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}'}, - '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'}, - 'sharing_status': {'key': 'properties.sharingStatus', 'type': 'SharingStatus'}, - } - - 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) - self.sharing_status = 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 - :ivar sharing_status: Sharing status of current gallery. - :vartype sharing_status: ~azure.mgmt.compute.v2021_07_01.models.SharingStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'sharing_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}'}, - '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'}, - 'sharing_status': {'key': 'properties.sharingStatus', 'type': 'SharingStatus'}, - } - - 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) - self.sharing_status = 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 RegionalSharingStatus(msrest.serialization.Model): - """Gallery regional sharing status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param region: Region name. - :type region: str - :ivar state: Gallery sharing state in current region. Possible values include: "Succeeded", - "InProgress", "Failed", "Unknown". - :vartype state: str or ~azure.mgmt.compute.v2021_07_01.models.SharingState - :param details: Details of gallery regional sharing failure. - :type details: str - """ - - _validation = { - 'state': {'readonly': True}, - } - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'details': {'key': 'details', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalSharingStatus, self).__init__(**kwargs) - self.region = kwargs.get('region', None) - self.state = None - self.details = kwargs.get('details', 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 - :param time_created: Gets the creation time of the restore point. - :type time_created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'source_metadata': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'consistency_mode': {'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'}, - 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, - } - - 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.time_created = kwargs.get('time_created', 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 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] - :param community_gallery_info: Information of community gallery if current gallery is shared to - community. - :type community_gallery_info: any - """ - - _validation = { - 'groups': {'readonly': True}, - } - - _attribute_map = { - 'permissions': {'key': 'permissions', 'type': 'str'}, - 'groups': {'key': 'groups', 'type': '[SharingProfileGroup]'}, - 'community_gallery_info': {'key': 'communityGalleryInfo', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingProfile, self).__init__(**kwargs) - self.permissions = kwargs.get('permissions', None) - self.groups = None - self.community_gallery_info = kwargs.get('community_gallery_info', 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** :code:`
`:code:`
` **Community**. Possible values - include: "Subscriptions", "AADTenants", "Community". - :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 SharingStatus(msrest.serialization.Model): - """Sharing status of current gallery. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregated_state: Aggregated sharing state of current gallery. Possible values include: - "Succeeded", "InProgress", "Failed", "Unknown". - :vartype aggregated_state: str or ~azure.mgmt.compute.v2021_07_01.models.SharingState - :param summary: Summary of all regional sharing status. - :type summary: list[~azure.mgmt.compute.v2021_07_01.models.RegionalSharingStatus] - """ - - _validation = { - 'aggregated_state': {'readonly': True}, - } - - _attribute_map = { - 'aggregated_state': {'key': 'aggregatedState', 'type': 'str'}, - 'summary': {'key': 'summary', 'type': '[RegionalSharingStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(SharingStatus, self).__init__(**kwargs) - self.aggregated_state = None - self.summary = kwargs.get('summary', 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", "EnableCommunity". - :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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models_py3.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models_py3.py index a4ad4684c8b..255feab3202 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/models/_models_py3.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/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) @@ -1261,9 +1523,9 @@ class CommunityGalleryDiskImage(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 + :vartype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching """ _validation = { @@ -1281,6 +1543,11 @@ def __init__( host_caching: Optional[Union[str, "HostCaching"]] = 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 + """ super(CommunityGalleryDiskImage, self).__init__(**kwargs) self.size_in_gb = None self.host_caching = host_caching @@ -1295,13 +1562,13 @@ class CommunityGalleryDataDiskImage(CommunityGalleryDiskImage): :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 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 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 = { @@ -1322,6 +1589,15 @@ def __init__( host_caching: Optional[Union[str, "HostCaching"]] = 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 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(CommunityGalleryDataDiskImage, self).__init__(host_caching=host_caching, **kwargs) self.lun = lun @@ -1337,35 +1613,40 @@ 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 + :ivar privacy_statement_uri: The uri to describe the privacy statement issued from community + gallery publisher. + :vartype privacy_statement_uri: str + :ivar eula: The uri to describe the eula issued from community gallery publisher. + :vartype eula: str """ _validation = { @@ -1388,6 +1669,8 @@ class CommunityGalleryImage(PirCommunityGalleryResource): 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, 'features': {'key': 'properties.features', 'type': '[GalleryImageFeature]'}, 'purchase_plan': {'key': 'properties.purchasePlan', 'type': 'ImagePurchasePlan'}, + 'privacy_statement_uri': {'key': 'properties.privacyStatementUri', 'type': 'str'}, + 'eula': {'key': 'properties.eula', 'type': 'str'}, } def __init__( @@ -1403,8 +1686,46 @@ def __init__( hyper_v_generation: Optional[Union[str, "HyperVGeneration"]] = None, features: Optional[List["GalleryImageFeature"]] = None, purchase_plan: Optional["ImagePurchasePlan"] = None, + privacy_statement_uri: Optional[str] = None, + eula: Optional[str] = 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 + :keyword privacy_statement_uri: The uri to describe the privacy statement issued from community + gallery publisher. + :paramtype privacy_statement_uri: str + :keyword eula: The uri to describe the eula issued from community gallery publisher. + :paramtype eula: str + """ super(CommunityGalleryImage, self).__init__(unique_id=unique_id, **kwargs) self.os_type = os_type self.os_state = os_state @@ -1415,6 +1736,8 @@ def __init__( self.hyper_v_generation = hyper_v_generation self.features = features self.purchase_plan = purchase_plan + self.privacy_statement_uri = privacy_statement_uri + self.eula = eula class CommunityGalleryImageList(msrest.serialization.Model): @@ -1422,11 +1745,11 @@ class CommunityGalleryImageList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of community gallery images. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImage] - :param next_link: The uri to fetch the next page of community gallery images. Call ListNext() + :ivar value: Required. A list of community gallery images. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImage] + :ivar next_link: The uri to fetch the next page of community gallery images. Call ListNext() with this to fetch the next page of community gallery images. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1445,6 +1768,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of community gallery images. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImage] + :keyword next_link: The uri to fetch the next page of community gallery images. Call ListNext() + with this to fetch the next page of community gallery images. + :paramtype next_link: str + """ super(CommunityGalleryImageList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1461,19 +1791,19 @@ 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 - :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 - :param storage_profile: This is the storage profile of a Gallery Image Version. - :type storage_profile: + :vartype end_of_life_date: ~datetime.datetime + :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 storage_profile: This is the storage profile of a Gallery Image Version. + :vartype storage_profile: ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionStorageProfile """ @@ -1504,6 +1834,22 @@ def __init__( storage_profile: Optional["CommunityGalleryImageVersionStorageProfile"] = 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 + :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 storage_profile: This is the storage profile of a Gallery Image Version. + :paramtype storage_profile: + ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionStorageProfile + """ super(CommunityGalleryImageVersion, self).__init__(unique_id=unique_id, **kwargs) self.published_date = published_date self.end_of_life_date = end_of_life_date @@ -1516,11 +1862,11 @@ class CommunityGalleryImageVersionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of community gallery image versions. - :type value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersion] - :param next_link: The uri to fetch the next page of community gallery image versions. Call + :ivar value: Required. A list of community gallery image versions. + :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersion] + :ivar next_link: The uri to fetch the next page of community gallery image versions. Call ListNext() with this to fetch the next page of community gallery image versions. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1539,6 +1885,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. A list of community gallery image versions. + :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersion] + :keyword next_link: The uri to fetch the next page of community gallery image versions. Call + ListNext() with this to fetch the next page of community gallery image versions. + :paramtype next_link: str + """ super(CommunityGalleryImageVersionList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1547,10 +1900,10 @@ def __init__( class CommunityGalleryImageVersionStorageProfile(msrest.serialization.Model): """This is the storage profile of a Gallery Image Version. - :param os_disk_image: This is the OS disk image. - :type os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryOSDiskImage - :param data_disk_images: A list of data disk images. - :type data_disk_images: + :ivar os_disk_image: This is the OS disk image. + :vartype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryOSDiskImage + :ivar data_disk_images: A list of data disk images. + :vartype data_disk_images: list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryDataDiskImage] """ @@ -1566,6 +1919,13 @@ def __init__( data_disk_images: Optional[List["CommunityGalleryDataDiskImage"]] = None, **kwargs ): + """ + :keyword os_disk_image: This is the OS disk image. + :paramtype os_disk_image: ~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryOSDiskImage + :keyword data_disk_images: A list of data disk images. + :paramtype data_disk_images: + list[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryDataDiskImage] + """ super(CommunityGalleryImageVersionStorageProfile, self).__init__(**kwargs) self.os_disk_image = os_disk_image self.data_disk_images = data_disk_images @@ -1576,14 +1936,14 @@ class CommunityGalleryInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param publisher_uri: Community gallery publisher uri. - :type publisher_uri: str - :param publisher_contact: Community gallery publisher contact email. - :type publisher_contact: str - :param eula: Community gallery publisher eula. - :type eula: str - :param public_name_prefix: Community gallery public name prefix. - :type public_name_prefix: str + :ivar publisher_uri: Community gallery publisher uri. + :vartype publisher_uri: str + :ivar publisher_contact: Community gallery publisher contact email. + :vartype publisher_contact: str + :ivar eula: Community gallery publisher eula. + :vartype eula: str + :ivar public_name_prefix: Community gallery public name prefix. + :vartype public_name_prefix: str :ivar community_gallery_enabled: Contains info about whether community gallery sharing is enabled. :vartype community_gallery_enabled: bool @@ -1614,6 +1974,16 @@ def __init__( public_name_prefix: Optional[str] = None, **kwargs ): + """ + :keyword publisher_uri: Community gallery publisher uri. + :paramtype publisher_uri: str + :keyword publisher_contact: Community gallery publisher contact email. + :paramtype publisher_contact: str + :keyword eula: Community gallery publisher eula. + :paramtype eula: str + :keyword public_name_prefix: Community gallery public name prefix. + :paramtype public_name_prefix: str + """ super(CommunityGalleryInfo, self).__init__(**kwargs) self.publisher_uri = publisher_uri self.publisher_contact = publisher_contact @@ -1630,9 +2000,9 @@ class CommunityGalleryOSDiskImage(CommunityGalleryDiskImage): :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 + :vartype host_caching: str or ~azure.mgmt.compute.v2021_07_01.models.HostCaching """ _validation = { @@ -1650,6 +2020,11 @@ def __init__( host_caching: Optional[Union[str, "HostCaching"]] = 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 + """ super(CommunityGalleryOSDiskImage, self).__init__(host_caching=host_caching, **kwargs) @@ -1674,6 +2049,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationListResult, self).__init__(**kwargs) self.value = None @@ -1719,6 +2096,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComputeOperationValue, self).__init__(**kwargs) self.origin = None self.name = None @@ -1735,44 +2114,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. @@ -1781,7 +2160,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 @@ -1791,13 +2170,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 = { @@ -1841,6 +2220,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 @@ -1880,6 +2316,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataDiskImage, self).__init__(**kwargs) self.lun = None @@ -1887,9 +2325,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 = { @@ -1902,6 +2340,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 @@ -1911,13 +2354,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 = { @@ -1936,6 +2379,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 @@ -1953,29 +2405,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. @@ -2026,6 +2478,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 @@ -2041,11 +2515,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 = { @@ -2060,6 +2534,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 @@ -2068,9 +2549,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 = { @@ -2083,6 +2565,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 @@ -2100,27 +2588,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 = { @@ -2156,6 +2644,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 @@ -2167,8 +2673,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 = { @@ -2181,6 +2687,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 @@ -2190,11 +2701,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 = { @@ -2213,6 +2724,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 @@ -2223,25 +2741,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 = { @@ -2268,6 +2786,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 @@ -2284,10 +2818,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 = { @@ -2307,6 +2842,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 @@ -2321,10 +2863,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 """ @@ -2348,6 +2891,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 @@ -2357,11 +2907,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 = { @@ -2380,6 +2930,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 @@ -2390,24 +2947,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. @@ -2446,6 +3003,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 @@ -2460,13 +3034,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 + :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. - :type boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnostics + :vartype boot_diagnostics: ~azure.mgmt.compute.v2021_07_01.models.BootDiagnostics """ _attribute_map = { @@ -2479,6 +3053,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 @@ -2486,10 +3069,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:`
    ` @@ -2497,7 +3080,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 = { @@ -2512,6 +3095,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 @@ -2520,8 +3117,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 = { @@ -2534,6 +3131,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 @@ -2541,9 +3142,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 = { @@ -2556,6 +3157,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 @@ -2563,8 +3169,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 = { @@ -2577,6 +3183,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -2584,8 +3194,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 = { @@ -2598,19 +3208,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 = { @@ -2627,6 +3241,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 @@ -2636,13 +3259,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 = { @@ -2659,6 +3283,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 @@ -2668,10 +3302,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 = { @@ -2686,6 +3320,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 @@ -2694,10 +3335,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 = { @@ -2712,6 +3353,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 @@ -2730,23 +3377,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 :ivar sharing_status: Sharing status of current gallery. :vartype sharing_status: ~azure.mgmt.compute.v2021_07_01.models.SharingStatus """ @@ -2785,6 +3432,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 @@ -2807,27 +3470,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 = { @@ -2864,6 +3527,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 @@ -2878,11 +3565,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 = { @@ -2901,6 +3588,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 @@ -2917,8 +3612,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 = { @@ -2940,6 +3635,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 @@ -2958,25 +3657,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 = { @@ -3010,6 +3709,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 @@ -3032,12 +3753,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". @@ -3075,6 +3796,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 @@ -3086,11 +3816,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 = { @@ -3109,6 +3839,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 @@ -3119,28 +3856,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 = { @@ -3168,6 +3905,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 @@ -3185,34 +3945,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 = { @@ -3247,6 +4007,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 @@ -3264,10 +4054,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". @@ -3302,6 +4092,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 @@ -3313,8 +4110,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 = { @@ -3331,6 +4128,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 @@ -3338,12 +4139,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 = { @@ -3358,6 +4159,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 @@ -3370,11 +4179,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 = { @@ -3394,6 +4203,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 @@ -3409,15 +4225,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 = { @@ -3440,6 +4256,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 @@ -3466,6 +4293,8 @@ def __init__( self, **kwargs ): + """ + """ super(GalleryIdentifier, self).__init__(**kwargs) self.unique_name = None @@ -3483,50 +4312,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 = { @@ -3579,6 +4408,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 @@ -3599,10 +4470,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 = { @@ -3617,6 +4488,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 @@ -3627,12 +4504,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 = { @@ -3655,6 +4532,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 @@ -3666,11 +4551,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 = { @@ -3689,6 +4574,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 @@ -3705,48 +4597,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 = { @@ -3796,6 +4688,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 @@ -3826,19 +4758,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 """ @@ -3873,6 +4806,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 @@ -3885,11 +4830,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 = { @@ -3908,6 +4853,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 @@ -3918,28 +4870,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 = { @@ -3967,18 +4919,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 = { @@ -3995,6 +4970,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 @@ -4012,17 +4995,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 """ @@ -4054,6 +5038,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 @@ -4066,11 +5060,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 = { @@ -4089,6 +5083,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 @@ -4101,11 +5102,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 = { @@ -4125,6 +5126,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) @@ -4139,21 +5147,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 :ivar sharing_status: Sharing status of current gallery. :vartype sharing_status: ~azure.mgmt.compute.v2021_07_01.models.SharingStatus """ @@ -4189,6 +5197,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 @@ -4201,7 +5223,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 @@ -4247,13 +5269,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 = { @@ -4268,6 +5290,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 @@ -4286,24 +5363,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 = { @@ -4338,6 +5416,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 @@ -4349,30 +5446,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 = { @@ -4397,6 +5496,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 @@ -4412,34 +5539,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 = { @@ -4470,6 +5599,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 @@ -4479,11 +5640,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 = { @@ -4502,6 +5663,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 @@ -4512,37 +5680,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 = { @@ -4576,6 +5746,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 @@ -4584,12 +5790,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 = { @@ -4606,6 +5812,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 @@ -4617,28 +5831,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 = { @@ -4666,6 +5880,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 @@ -4678,19 +5912,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 = { @@ -4707,6 +5941,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 @@ -4718,20 +5967,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 = { @@ -4755,6 +6005,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 @@ -4765,10 +6030,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 = { @@ -4783,6 +6048,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 @@ -4791,16 +6062,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 = { @@ -4821,6 +6092,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 @@ -4834,10 +6117,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 = { @@ -4857,6 +6140,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 @@ -4867,10 +6156,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 = { @@ -4890,6 +6179,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 @@ -4965,6 +6260,8 @@ def __init__( self, **kwargs ): + """ + """ super(LastPatchInstallationSummary, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -4982,19 +6279,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 = { @@ -5013,6 +6310,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 @@ -5023,19 +6335,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 = { @@ -5054,6 +6366,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 @@ -5064,21 +6391,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 = { @@ -5093,6 +6421,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 @@ -5103,11 +6449,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 = { @@ -5126,6 +6472,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 @@ -5136,23 +6489,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 = { @@ -5185,6 +6538,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 @@ -5217,6 +6589,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOperationResult, self).__init__(**kwargs) self.properties = None @@ -5242,6 +6616,8 @@ def __init__( self, **kwargs ): + """ + """ super(LogAnalyticsOutput, self).__init__(**kwargs) self.output = None @@ -5249,23 +6625,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 = { @@ -5290,6 +6666,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 @@ -5305,8 +6700,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 = { @@ -5323,6 +6718,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The managed artifact id. + :paramtype id: str + """ super(ManagedArtifact, self).__init__(**kwargs) self.id = id @@ -5330,16 +6729,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 = { @@ -5356,6 +6757,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 @@ -5364,14 +6779,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 = { @@ -5388,6 +6803,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 @@ -5396,17 +6821,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] """ @@ -5424,6 +6849,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 @@ -5435,12 +6874,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 = { @@ -5460,6 +6899,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 @@ -5492,6 +6941,8 @@ def __init__( self, **kwargs ): + """ + """ super(OrchestrationServiceSummary, self).__init__(**kwargs) self.service_name = None self.service_state = None @@ -5502,56 +6953,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 = { @@ -5590,6 +7041,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 @@ -5610,9 +7113,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 = { @@ -5629,6 +7132,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 @@ -5636,46 +7144,91 @@ 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 + :ivar security_profile: This property specifies the security profile of an OS disk image. + :vartype security_profile: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImageSecurityProfile """ _attribute_map = { 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + 'security_profile': {'key': 'securityProfile', 'type': 'OSDiskImageSecurityProfile'}, } def __init__( self, *, disk_encryption_set_id: Optional[str] = None, + security_profile: Optional["OSDiskImageSecurityProfile"] = 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 security_profile: This property specifies the security profile of an OS disk image. + :paramtype security_profile: ~azure.mgmt.compute.v2021_07_01.models.OSDiskImageSecurityProfile + """ super(OSDiskImageEncryption, self).__init__(disk_encryption_set_id=disk_encryption_set_id, **kwargs) + self.security_profile = security_profile + + +class OSDiskImageSecurityProfile(msrest.serialization.Model): + """Contains security profile for an OS disk image. + + :ivar type: all types of security profile. Possible values include: + "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk". + :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.SecurityProfileType + :ivar secure_vm_disk_encryption_set_id: secure VM disk encryption set id. + :vartype secure_vm_disk_encryption_set_id: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'secure_vm_disk_encryption_set_id': {'key': 'secureVMDiskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SecurityProfileType"]] = None, + secure_vm_disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword type: all types of security profile. Possible values include: + "EncryptedVMGuestStateOnlyWithPmk", "EncryptedWithPmk", "EncryptedWithCmk". + :paramtype type: str or ~azure.mgmt.compute.v2021_07_01.models.SecurityProfileType + :keyword secure_vm_disk_encryption_set_id: secure VM disk encryption set id. + :paramtype secure_vm_disk_encryption_set_id: str + """ + super(OSDiskImageSecurityProfile, self).__init__(**kwargs) + self.type = type + self.secure_vm_disk_encryption_set_id = secure_vm_disk_encryption_set_id 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 @@ -5689,8 +7242,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 @@ -5700,30 +7253,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 = { @@ -5752,6 +7305,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 @@ -5809,6 +7431,8 @@ def __init__( self, **kwargs ): + """ + """ super(PatchInstallationDetail, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -5821,7 +7445,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 @@ -5832,18 +7456,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 = { @@ -5860,6 +7485,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 @@ -5891,6 +7542,8 @@ def __init__( self, **kwargs ): + """ + """ super(PirResource, self).__init__(**kwargs) self.name = None self.location = None @@ -5905,8 +7558,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 = { @@ -5926,6 +7579,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 @@ -5933,15 +7590,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 = { @@ -5960,6 +7617,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 @@ -5980,15 +7648,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. @@ -6002,8 +7670,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 = { @@ -6038,6 +7706,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 @@ -6051,10 +7733,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 = { @@ -6073,6 +7755,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 @@ -6081,8 +7769,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 = { @@ -6095,6 +7783,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) @@ -6127,6 +7819,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -6136,10 +7830,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 = { @@ -6154,6 +7848,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 @@ -6164,13 +7864,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 = { @@ -6193,6 +7893,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 @@ -6202,10 +7911,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 = { @@ -6220,6 +7929,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 @@ -6251,6 +7966,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoveryWalkResponse, self).__init__(**kwargs) self.walk_performed = None self.next_platform_update_domain = None @@ -6290,6 +8007,8 @@ def __init__( self, **kwargs ): + """ + """ super(RegionalReplicationStatus, self).__init__(**kwargs) self.region = None self.state = None @@ -6302,13 +8021,13 @@ class RegionalSharingStatus(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param region: Region name. - :type region: str + :ivar region: Region name. + :vartype region: str :ivar state: Gallery sharing state in current region. Possible values include: "Succeeded", "InProgress", "Failed", "Unknown". :vartype state: str or ~azure.mgmt.compute.v2021_07_01.models.SharingState - :param details: Details of gallery regional sharing failure. - :type details: str + :ivar details: Details of gallery regional sharing failure. + :vartype details: str """ _validation = { @@ -6328,6 +8047,12 @@ def __init__( details: Optional[str] = None, **kwargs ): + """ + :keyword region: Region name. + :paramtype region: str + :keyword details: Details of gallery regional sharing failure. + :paramtype details: str + """ super(RegionalSharingStatus, self).__init__(**kwargs) self.region = region self.state = None @@ -6362,6 +8087,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = None @@ -6372,26 +8099,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 = { @@ -6427,6 +8154,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 @@ -6434,10 +8183,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 = { @@ -6452,6 +8201,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 @@ -6530,6 +8285,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -6571,6 +8328,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -6610,6 +8369,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -6646,6 +8407,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -6689,6 +8452,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -6722,6 +8487,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -6763,6 +8530,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -6775,11 +8544,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 = { @@ -6798,6 +8567,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 @@ -6829,6 +8605,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = None self.capabilities = None @@ -6845,9 +8623,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 @@ -6857,8 +8635,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 - :param time_created: Gets the creation time of the restore point. - :type time_created: ~datetime.datetime + :ivar time_created: Gets the creation time of the restore point. + :vartype time_created: ~datetime.datetime """ _validation = { @@ -6888,6 +8666,13 @@ def __init__( 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 @@ -6909,13 +8694,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. @@ -6955,6 +8740,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 @@ -6965,11 +8760,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 = { @@ -6984,6 +8779,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 @@ -6996,8 +8798,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 = { @@ -7015,6 +8817,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 @@ -7025,11 +8831,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. @@ -7060,6 +8866,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 @@ -7070,23 +8884,23 @@ def __init__( 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 = { @@ -7113,6 +8927,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 @@ -7127,20 +8960,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 = { @@ -7163,6 +8995,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 @@ -7175,21 +9023,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 = { @@ -7214,6 +9061,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 @@ -7227,11 +9091,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 = { @@ -7246,6 +9110,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 @@ -7276,6 +9149,8 @@ def __init__( self, **kwargs ): + """ + """ super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) self.console_screenshot_blob_uri = None self.serial_console_log_blob_uri = None @@ -7311,6 +9186,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollbackStatusInfo, self).__init__(**kwargs) self.successfully_rolledback_instance_count = None self.failed_rolledback_instance_count = None @@ -7320,33 +9197,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 = { @@ -7375,6 +9252,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 @@ -7418,6 +9324,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeProgressInfo, self).__init__(**kwargs) self.successful_instance_count = None self.failed_instance_count = None @@ -7460,6 +9368,8 @@ def __init__( self, **kwargs ): + """ + """ super(RollingUpgradeRunningStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -7480,10 +9390,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. @@ -7525,6 +9435,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 @@ -7537,17 +9453,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 = { @@ -7576,6 +9492,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 @@ -7589,21 +9518,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 = { @@ -7637,6 +9566,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 @@ -7647,13 +9594,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 = { @@ -7674,6 +9621,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 @@ -7685,10 +9641,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 = { @@ -7708,6 +9664,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 @@ -7718,11 +9680,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 = { @@ -7741,6 +9703,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 @@ -7751,14 +9720,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 = { @@ -7782,6 +9751,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 @@ -7792,8 +9771,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 = { @@ -7806,6 +9785,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 @@ -7813,7 +9796,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 @@ -7827,12 +9810,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 = { @@ -7847,6 +9830,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 @@ -7855,9 +9860,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 """ @@ -7871,6 +9876,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 @@ -7878,20 +9889,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 = { @@ -7908,6 +9919,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 @@ -7923,8 +9950,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 = { @@ -7944,6 +9971,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) @@ -7956,35 +9987,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 = { @@ -8022,6 +10053,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 @@ -8039,11 +10101,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 = { @@ -8062,6 +10124,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 @@ -8076,14 +10145,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 = { @@ -8107,6 +10176,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 @@ -8117,11 +10196,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 = { @@ -8140,6 +10219,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 @@ -8150,11 +10236,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 = { @@ -8173,6 +10259,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 @@ -8183,15 +10276,17 @@ 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 + :code:`
    `:code:`
    ` **Groups** :code:`
    `:code:`
    ` **Community**. Possible values + include: "Private", "Groups", "Community". + :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] - :param community_gallery_info: Information of community gallery if current gallery is shared to + :ivar community_gallery_info: Information of community gallery if current gallery is shared to community. - :type community_gallery_info: any + :vartype community_gallery_info: any """ _validation = { @@ -8211,6 +10306,17 @@ def __init__( community_gallery_info: Optional[Any] = 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** :code:`
    `:code:`
    ` **Community**. Possible values + include: "Private", "Groups", "Community". + :paramtype permissions: str or + ~azure.mgmt.compute.v2021_07_01.models.GallerySharingPermissionTypes + :keyword community_gallery_info: Information of community gallery if current gallery is shared + to community. + :paramtype community_gallery_info: any + """ super(SharingProfile, self).__init__(**kwargs) self.permissions = permissions self.groups = None @@ -8220,13 +10326,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** :code:`
    `:code:`
    ` **Community**. Possible values - include: "Subscriptions", "AADTenants", "Community". - :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] + :code:`
    `:code:`
    ` **AADTenants**. Possible values include: "Subscriptions", + "AADTenants". + :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 = { @@ -8241,6 +10347,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 @@ -8254,8 +10369,8 @@ class SharingStatus(msrest.serialization.Model): :ivar aggregated_state: Aggregated sharing state of current gallery. Possible values include: "Succeeded", "InProgress", "Failed", "Unknown". :vartype aggregated_state: str or ~azure.mgmt.compute.v2021_07_01.models.SharingState - :param summary: Summary of all regional sharing status. - :type summary: list[~azure.mgmt.compute.v2021_07_01.models.RegionalSharingStatus] + :ivar summary: Summary of all regional sharing status. + :vartype summary: list[~azure.mgmt.compute.v2021_07_01.models.RegionalSharingStatus] """ _validation = { @@ -8273,6 +10388,10 @@ def __init__( summary: Optional[List["RegionalSharingStatus"]] = None, **kwargs ): + """ + :keyword summary: Summary of all regional sharing status. + :paramtype summary: list[~azure.mgmt.compute.v2021_07_01.models.RegionalSharingStatus] + """ super(SharingStatus, self).__init__(**kwargs) self.aggregated_state = None self.summary = summary @@ -8283,13 +10402,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", "EnableCommunity". - :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 = { @@ -8308,6 +10428,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", "EnableCommunity". + :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 @@ -8316,14 +10446,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 = { @@ -8340,6 +10470,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 @@ -8349,9 +10489,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 = { @@ -8364,6 +10504,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 @@ -8371,12 +10516,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 = { @@ -8391,6 +10536,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 @@ -8399,8 +10553,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 = { @@ -8413,6 +10567,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 @@ -8420,15 +10578,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 = { @@ -8443,6 +10601,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 @@ -8453,16 +10622,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 = { @@ -8485,6 +10654,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 @@ -8504,15 +10685,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 = { @@ -8539,6 +10720,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 @@ -8548,11 +10740,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 = { @@ -8571,6 +10763,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 @@ -8579,13 +10778,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 = { @@ -8600,6 +10799,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 @@ -8607,21 +10815,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 = { @@ -8638,6 +10846,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 @@ -8665,6 +10890,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResourceReadOnly, self).__init__(**kwargs) self.id = None @@ -8672,11 +10899,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 = { @@ -8691,6 +10918,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 @@ -8700,18 +10934,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 = { @@ -8734,6 +10968,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 @@ -8744,13 +10993,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 = { @@ -8765,6 +11014,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 @@ -8775,23 +11033,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 = { @@ -8824,18 +11082,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 = { @@ -8850,6 +11127,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 @@ -8885,6 +11170,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) self.properties = None self.type = None @@ -8933,6 +11220,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) self.running_status = None self.progress = None @@ -8972,6 +11261,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) self.code = None self.start_time = None @@ -8981,19 +11272,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 """ @@ -9011,6 +11302,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 @@ -9026,12 +11333,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 = { @@ -9058,6 +11365,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 @@ -9067,10 +11382,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 = { @@ -9085,6 +11400,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 @@ -9095,16 +11416,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 = { @@ -9126,6 +11447,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 @@ -9137,12 +11470,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 = { @@ -9161,6 +11494,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 @@ -9191,6 +11532,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -9199,7 +11542,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 @@ -9210,14 +11553,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 = { @@ -9232,6 +11575,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 @@ -9240,12 +11604,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 = { @@ -9260,6 +11624,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 @@ -9268,8 +11640,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 = { @@ -9282,6 +11654,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 @@ -9299,43 +11675,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 @@ -9348,46 +11724,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: @@ -9397,16 +11772,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' @@ -9414,18 +11789,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 = { @@ -9510,6 +11887,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 @@ -9546,13 +12046,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 = { @@ -9569,6 +12069,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 @@ -9634,6 +12143,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) self.status = None self.assessment_activity_id = None @@ -9650,13 +12161,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 = { @@ -9679,6 +12190,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 @@ -9690,8 +12210,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. @@ -9723,6 +12243,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 @@ -9743,40 +12267,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 = { @@ -9823,6 +12348,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 @@ -9840,12 +12400,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 = { @@ -9862,6 +12422,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 @@ -9881,23 +12449,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 = { @@ -9932,6 +12500,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 @@ -9943,16 +12530,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 = { @@ -9973,6 +12560,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 @@ -9984,8 +12583,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 = { @@ -9998,6 +12597,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 @@ -10005,33 +12608,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 = { @@ -10062,6 +12665,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 @@ -10095,6 +12727,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineHealthStatus, self).__init__(**kwargs) self.status = None @@ -10110,15 +12744,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] """ @@ -10141,6 +12775,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 @@ -10153,18 +12799,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 = { @@ -10190,6 +12836,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 @@ -10202,36 +12862,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 = { @@ -10271,6 +12932,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 @@ -10284,10 +12979,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 = { @@ -10302,6 +12997,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 @@ -10312,18 +13013,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 = { @@ -10346,6 +13048,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 @@ -10430,6 +13147,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineInstallPatchesResult, self).__init__(**kwargs) self.status = None self.installation_activity_id = None @@ -10450,47 +13169,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 = { @@ -10536,6 +13255,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 @@ -10558,10 +13314,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 = { @@ -10576,6 +13332,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 @@ -10586,11 +13348,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 = { @@ -10609,6 +13371,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 @@ -10619,31 +13388,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 = { @@ -10678,6 +13447,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 @@ -10694,8 +13490,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 = { @@ -10708,6 +13504,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 @@ -10717,34 +13517,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] """ @@ -10776,6 +13576,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 @@ -10792,12 +13624,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: @@ -10821,6 +13653,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 @@ -10832,29 +13674,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 """ @@ -10888,6 +13730,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 @@ -10905,10 +13773,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 = { @@ -10925,6 +13793,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 @@ -10932,9 +13806,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 = { @@ -10947,6 +13821,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 @@ -10964,33 +13843,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. @@ -11042,6 +13921,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 @@ -11059,23 +13967,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 = { @@ -11102,6 +14010,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 @@ -11116,12 +14043,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 = { @@ -11138,6 +14065,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 @@ -11149,10 +14084,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 = { @@ -11171,6 +14106,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 @@ -11181,31 +14122,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. @@ -11248,6 +14189,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 @@ -11275,75 +14243,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 = { @@ -11410,6 +14378,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 @@ -11439,39 +14476,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 = { @@ -11505,6 +14542,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 @@ -11524,41 +14596,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 = { @@ -11600,6 +14672,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 @@ -11621,11 +14726,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 = { @@ -11644,6 +14749,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 @@ -11652,13 +14764,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 = { @@ -11673,6 +14786,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 @@ -11689,37 +14812,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 = { @@ -11761,6 +14884,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 @@ -11788,17 +14942,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] """ @@ -11821,6 +14974,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 @@ -11853,6 +15020,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -11869,8 +15038,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] @@ -11895,6 +15064,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 @@ -11924,6 +15097,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) self.statuses_summary = None @@ -11933,39 +15108,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 = { @@ -12000,6 +15176,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 @@ -12015,10 +15229,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 = { @@ -12033,6 +15247,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 @@ -12043,11 +15263,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 = { @@ -12066,6 +15287,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 @@ -12076,11 +15305,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 = { @@ -12099,6 +15328,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 @@ -12109,11 +15345,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 = { @@ -12132,6 +15368,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 @@ -12142,11 +15385,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 = { @@ -12165,6 +15408,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 @@ -12173,14 +15423,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 = { @@ -12195,6 +15447,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 @@ -12205,31 +15469,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 = { @@ -12264,6 +15528,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 @@ -12279,8 +15570,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 = { @@ -12293,6 +15584,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 @@ -12300,17 +15595,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 = { @@ -12327,6 +15622,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 @@ -12338,43 +15646,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 """ @@ -12410,6 +15718,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 @@ -12426,20 +15774,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 @@ -12453,28 +15800,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 = { @@ -12499,6 +15846,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 @@ -12514,26 +15912,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 = { @@ -12564,6 +15962,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 @@ -12580,10 +16000,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 = { @@ -12600,6 +16020,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 @@ -12607,9 +16033,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 = { @@ -12622,19 +16048,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 = { @@ -12649,6 +16080,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 @@ -12682,6 +16122,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSku, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -12723,6 +16165,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -12733,21 +16177,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 = { @@ -12764,6 +16209,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 @@ -12773,45 +16236,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 = { @@ -12848,6 +16311,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 @@ -12866,34 +16372,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 = { @@ -12924,6 +16430,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 @@ -12939,30 +16477,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 = { @@ -12993,6 +16531,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 @@ -13008,17 +16572,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 = { @@ -13035,6 +16599,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 @@ -13044,23 +16621,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 """ @@ -13084,6 +16661,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 @@ -13096,14 +16693,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 = { @@ -13122,6 +16719,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 @@ -13132,16 +16739,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 = { @@ -13160,6 +16767,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 @@ -13170,12 +16789,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 = { @@ -13192,6 +16812,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 @@ -13201,31 +16830,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 = { @@ -13256,6 +16887,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 @@ -13282,20 +16942,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. @@ -13308,29 +16968,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 @@ -13340,10 +17000,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: @@ -13353,16 +17013,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 = { @@ -13431,6 +17091,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 @@ -13467,36 +17190,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 = { @@ -13538,6 +17262,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 @@ -13557,8 +17312,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 = { @@ -13571,6 +17326,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 @@ -13601,6 +17361,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) self.name = None self.statuses_summary = None @@ -13617,32 +17379,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 = { @@ -13680,6 +17442,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 @@ -13697,10 +17487,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 = { @@ -13713,6 +17503,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 @@ -13722,8 +17518,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 = { @@ -13740,6 +17536,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 @@ -13749,39 +17549,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 = { @@ -13819,6 +17619,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 @@ -13839,11 +17667,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 = { @@ -13862,6 +17690,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 @@ -13870,8 +17705,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] """ @@ -13885,6 +17720,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 @@ -13892,27 +17732,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: @@ -13922,34 +17762,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 = { @@ -13988,6 +17830,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 @@ -14008,13 +17912,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 = { @@ -14029,6 +17933,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 @@ -14037,24 +17950,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 = { @@ -14077,6 +17990,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 @@ -14089,8 +18022,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 = { @@ -14103,6 +18036,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 @@ -14168,6 +18105,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) self.patch_id = None self.name = None @@ -14206,6 +18145,8 @@ def __init__( self, **kwargs ): + """ + """ super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None @@ -14216,37 +18157,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 @@ -14259,46 +18200,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: @@ -14308,16 +18248,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' @@ -14325,18 +18265,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 = { @@ -14408,6 +18350,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 @@ -14444,17 +18505,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 = { @@ -14477,6 +18538,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 @@ -14487,11 +18561,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 = { @@ -14504,6 +18578,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 @@ -14511,20 +18592,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 = { @@ -14539,6 +18619,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 @@ -14547,31 +18643,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 = { @@ -14594,6 +18690,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 @@ -14606,20 +18729,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 = { @@ -14640,6 +18763,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 @@ -14651,8 +18790,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 = { @@ -14665,6 +18804,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 @@ -14672,11 +18815,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 @@ -14687,7 +18830,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 = { @@ -14702,6 +18845,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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_availability_sets_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_availability_sets_operations.py index f8785d221e7..ad4ffa956aa 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_availability_sets_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes") # pylint: disable=line-too-long + 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 +308,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,33 +334,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AvailabilitySet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,16 +369,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 + 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,33 +399,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AvailabilitySetUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,15 +434,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore - def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,26 +461,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -231,15 +489,16 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + 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,28 +515,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -290,59 +546,62 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + 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'. + 'instanceView'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -351,7 +610,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -360,60 +623,63 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -422,7 +688,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,18 +701,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 + 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,45 +722,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -498,7 +772,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -507,7 +785,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes'} # type: ignore + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservation_groups_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservation_groups_operations.py index 74de4b67fd1..dce8153fd38 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservation_groups_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservation_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,263 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups") # pylint: disable=line-too-long + 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 +286,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,33 +314,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -116,16 +353,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 + 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,33 +384,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -184,15 +419,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore - def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,28 +449,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -243,16 +477,17 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + 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. @@ -262,8 +497,9 @@ def get( :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve 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 + platform and can change outside of control plane operations. Default value is None. + :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,30 +510,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -310,15 +542,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + 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. @@ -326,49 +560,52 @@ def list_by_resource_group( :type resource_group_name: str :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 + associated to capacity reservation group in the response. Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -377,7 +614,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -386,64 +627,67 @@ 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 + 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 + associated to capacity reservation group in the response. Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -452,7 +696,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -461,7 +709,8 @@ 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/capacityReservationGroups'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservations_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservations_operations.py index 9ba71603545..36d82ea6555 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservations_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_capacity_reservations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations") # pylint: disable=line-too-long + 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,46 +260,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -105,17 +311,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 + _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,14 +338,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( @@ -151,28 +365,22 @@ def begin_create_or_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + api_version=api_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('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: @@ -182,52 +390,47 @@ def get_long_running_output(pipeline_response): 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -242,17 +445,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 + _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,14 +470,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( @@ -286,28 +497,22 @@ def begin_update( capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, parameters=parameters, + api_version=api_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('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: @@ -317,46 +522,42 @@ def get_long_running_output(pipeline_response): 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -366,16 +567,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +590,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -408,25 +613,18 @@ def begin_delete( resource_group_name=resource_group_name, capacity_reservation_group_name=capacity_reservation_group_name, capacity_reservation_name=capacity_reservation_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_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: @@ -436,19 +634,19 @@ def get_long_running_output(pipeline_response): 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/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}'} # type: ignore + 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. @@ -459,8 +657,9 @@ def get( :type capacity_reservation_name: str :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 + and can change outside of control plane operations. Default value is None. + :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,31 +670,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -508,15 +703,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 + 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,45 +722,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -572,7 +772,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -581,7 +785,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_capacity_reservation_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations'} # type: ignore + list_by_capacity_reservation_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_galleries_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_galleries_operations.py index 16a13033a94..06b2dd5d9f9 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_galleries_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,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 warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}") # pylint: disable=line-too-long + 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 +82,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,28 +105,25 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,4 +136,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_image_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_image_versions_operations.py index f5684213c0e..321592fc781 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_image_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,102 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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]] + +_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") # pylint: disable=line-too-long + 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 + ) + + +def build_list_request( + subscription_id: str, + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions") # pylint: disable=line-too-long + 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) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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. @@ -45,15 +125,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. @@ -77,30 +157,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,16 +190,18 @@ 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 + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore + + + @distributed_trace def list( self, - location, # type: str - public_gallery_name, # type: str - gallery_image_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CommunityGalleryImageVersionList"] + location: str, + public_gallery_name: str, + gallery_image_name: str, + **kwargs: Any + ) -> Iterable["_models.CommunityGalleryImageVersionList"]: """List community gallery image versions inside an image. :param location: Resource location. @@ -132,46 +211,50 @@ def list( :param gallery_image_name: The name of the community gallery image definition. :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 CommunityGalleryImageVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionList] + :return: An iterator like instance of either CommunityGalleryImageVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageVersionList"] error_map = { 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'), - '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 = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + public_gallery_name=public_gallery_name, + gallery_image_name=gallery_image_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CommunityGalleryImageVersionList', pipeline_response) + deserialized = self._deserialize("CommunityGalleryImageVersionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,7 +263,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -189,7 +276,8 @@ 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}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_images_operations.py index f5195fcbee3..12d0a0e5327 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_community_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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]] + +_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}") # pylint: disable=line-too-long + 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 + ) + + +def build_list_request( + subscription_id: str, + location: str, + public_gallery_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images") # pylint: disable=line-too-long + 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) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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. @@ -45,14 +121,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. @@ -71,29 +147,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,15 +179,17 @@ 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 + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}"} # type: ignore + + + @distributed_trace def list( self, - location, # type: str - public_gallery_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CommunityGalleryImageList"] + location: str, + public_gallery_name: str, + **kwargs: Any + ) -> Iterable["_models.CommunityGalleryImageList"]: """List community gallery images inside a gallery. :param location: Resource location. @@ -122,45 +197,48 @@ def list( :param public_gallery_name: The public name of the community gallery. :type public_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 CommunityGalleryImageList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageList] + :return: An iterator like instance of either CommunityGalleryImageList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.CommunityGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunityGalleryImageList"] error_map = { 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'), - '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 = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + public_gallery_name=public_gallery_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + public_gallery_name=public_gallery_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CommunityGalleryImageList', pipeline_response) + deserialized = self._deserialize("CommunityGalleryImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -169,7 +247,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,7 +260,8 @@ 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}/communityGalleries/{publicGalleryName}/images'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_host_groups_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_host_groups_operations.py index dccc95da735..3c4b5cda87a 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_host_groups_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,249 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 +272,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,33 +300,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHostGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -116,16 +339,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 + 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,33 +369,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,15 +404,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore - def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,26 +431,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -237,16 +459,17 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + 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. @@ -255,7 +478,7 @@ def get( :type host_group_name: str :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is - not supported for dedicated host group. + not supported for dedicated host group. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -267,30 +490,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -303,58 +522,62 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -363,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -372,57 +599,59 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -431,7 +660,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -440,7 +673,8 @@ 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/hostGroups'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_hosts_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_hosts_operations.py index 1c9bac974eb..f14fd558408 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_hosts_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts") # pylint: disable=line-too-long + 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,46 +254,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHost') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -105,17 +305,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 + _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,14 +330,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( @@ -149,28 +356,22 @@ def begin_create_or_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + api_version=api_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('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: @@ -180,52 +381,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DedicatedHostUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,17 +434,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 + _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,14 +459,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( @@ -282,28 +485,22 @@ def begin_update( host_group_name=host_group_name, host_name=host_name, parameters=parameters, + api_version=api_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('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: @@ -313,44 +510,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -360,16 +555,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +576,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -400,25 +599,18 @@ def begin_delete( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_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: @@ -428,19 +620,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + 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. @@ -451,7 +643,7 @@ def get( :type host_name: str :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated - host. + host. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -463,31 +655,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -500,15 +688,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 + 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,45 +707,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -564,7 +757,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -573,7 +770,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_host_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts'} # type: ignore + list_by_host_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_galleries_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_galleries_operations.py index e9c66691d7a..3aa087fa2c6 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_galleries_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,257 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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,44 +282,39 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -106,16 +334,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 + _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,14 +357,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( @@ -147,27 +381,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + api_version=api_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('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: @@ -177,50 +406,45 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gallery, 'GalleryUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + gallery_name=gallery_name, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,16 +457,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 + _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,14 +480,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( @@ -274,27 +504,22 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery=gallery, + api_version=api_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('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: @@ -304,25 +529,25 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}'} # type: ignore + 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. :type resource_group_name: str :param gallery_name: The name of the Shared Image Gallery. :type gallery_name: str - :param select: The select expression to apply on the operation. + :param select: The select expression to apply on the operation. Default value is None. :type select: str or ~azure.mgmt.compute.v2021_07_01.models.SelectPermissions :keyword callable cls: A custom type or function that will be passed the direct response :return: Gallery, or the result of cls(response) @@ -334,30 +559,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -370,42 +591,40 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -415,15 +634,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +652,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -451,24 +674,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, gallery_name=gallery_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -478,16 +695,16 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}'} # type: ignore + 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,40 +714,40 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -539,7 +756,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -548,16 +769,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 + 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,39 +787,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -606,7 +827,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -615,7 +840,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_application_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_application_versions_operations.py index edab37e5f88..1fe2b9b8da5 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_application_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,245 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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,48 +270,43 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -110,18 +326,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 + _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,17 +357,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( @@ -164,29 +389,22 @@ 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, + api_version=api_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: @@ -196,54 +414,49 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -256,18 +469,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 + _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,17 +500,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( @@ -310,29 +532,22 @@ def begin_update( gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, gallery_application_version=gallery_application_version, + api_version=api_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: @@ -342,20 +557,20 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + 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. @@ -369,7 +584,7 @@ def get( :param gallery_application_version_name: The name of the gallery Application Version to be retrieved. :type gallery_application_version_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatusTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: GalleryApplicationVersion, or the result of cls(response) @@ -381,32 +596,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -419,46 +630,44 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -468,17 +677,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +704,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -515,26 +728,18 @@ def begin_delete( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application_version_name=gallery_application_version_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -544,18 +749,18 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + 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,46 +772,50 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -615,7 +824,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -624,7 +837,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_gallery_application.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions'} # type: ignore + list_by_gallery_application.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_applications_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_applications_operations.py index 921d01cc4e8..971cff7faf6 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_applications_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,231 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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,46 +256,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -108,17 +310,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 + _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,14 +339,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( @@ -156,28 +366,22 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + api_version=api_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('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: @@ -187,52 +391,47 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -245,17 +444,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 + _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,14 +472,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( @@ -292,28 +499,22 @@ def begin_update( gallery_name=gallery_name, gallery_application_name=gallery_application_name, gallery_application=gallery_application, + api_version=api_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('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: @@ -323,18 +524,18 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + 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,29 +556,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -390,44 +588,42 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -437,16 +633,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +655,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -478,25 +678,18 @@ def begin_delete( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_application_name=gallery_application_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -506,17 +699,17 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + 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,45 +718,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -572,7 +768,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -581,7 +781,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications'} # type: ignore + list_by_gallery.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_image_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_image_versions_operations.py index baee0a78d36..200ca7d1753 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_image_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,245 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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,48 +270,43 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -110,18 +326,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 + _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,14 +360,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( @@ -164,29 +388,22 @@ 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, + api_version=api_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: @@ -196,54 +413,49 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -256,18 +468,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 + _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,14 +502,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( @@ -310,29 +530,22 @@ def begin_update( gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, gallery_image_version=gallery_image_version, + api_version=api_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: @@ -342,20 +555,20 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + 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. @@ -368,7 +581,7 @@ def get( :type gallery_image_name: str :param gallery_image_version_name: The name of the gallery image version to be retrieved. :type gallery_image_version_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ReplicationStatusTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: GalleryImageVersion, or the result of cls(response) @@ -380,32 +593,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -418,46 +627,44 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -467,17 +674,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +700,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -513,26 +724,18 @@ def begin_delete( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image_version_name=gallery_image_version_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -542,18 +745,18 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + 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,46 +768,50 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -613,7 +820,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -622,7 +833,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_gallery_image.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions'} # type: ignore + list_by_gallery_image.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_images_operations.py index b9a2b21e8b1..0103c3ae8bf 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,231 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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,46 +256,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -108,17 +310,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 + _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,14 +338,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( @@ -155,28 +364,22 @@ def begin_create_or_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + api_version=api_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('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: @@ -186,52 +389,47 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -244,17 +442,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 + _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,14 +470,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( @@ -291,28 +496,22 @@ def begin_update( gallery_name=gallery_name, gallery_image_name=gallery_image_name, gallery_image=gallery_image, + api_version=api_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('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: @@ -322,18 +521,18 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + 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,29 +552,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -388,44 +584,42 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -435,16 +629,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +651,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -476,25 +674,18 @@ def begin_delete( resource_group_name=resource_group_name, gallery_name=gallery_name, gallery_image_name=gallery_image_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -504,17 +695,17 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + 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. @@ -527,41 +718,42 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -570,7 +762,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -579,7 +775,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_gallery.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images'} # type: ignore + list_by_gallery.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_sharing_profile_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_sharing_profile_operations.py index 26c36521106..8e1f3533977 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_sharing_profile_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_gallery_sharing_profile_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,70 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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,44 +95,39 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -102,16 +144,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 + _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,14 +166,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( @@ -142,27 +191,22 @@ def begin_update( resource_group_name=resource_group_name, gallery_name=gallery_name, sharing_update=sharing_update, + api_version=api_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('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: @@ -172,6 +216,6 @@ def get_long_running_output(pipeline_response): 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/galleries/{galleryName}/share'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_images_operations.py index 4f037373b8f..636b6e2f52d 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,251 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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,44 +276,39 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Image') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -103,16 +325,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 + _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,14 +347,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( @@ -143,27 +371,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + api_version=api_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('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: @@ -173,50 +396,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ImageUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ImageUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -233,16 +451,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 + _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,14 +473,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( @@ -273,27 +497,22 @@ def begin_update( resource_group_name=resource_group_name, image_name=image_name, parameters=parameters, + api_version=api_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('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: @@ -303,42 +522,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -348,15 +565,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +583,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -384,24 +605,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, image_name=image_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_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: @@ -411,25 +626,25 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + 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. :type resource_group_name: str :param image_name: The name of the image. :type image_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Image, or the result of cls(response) @@ -441,30 +656,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,14 +688,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + 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. @@ -494,40 +707,40 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -536,7 +749,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -545,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/images'} # type: ignore + 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. @@ -563,39 +781,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -604,7 +821,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,7 +834,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_log_analytics_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_log_analytics_operations.py index 9493cd90ad2..06bd0d0a46f 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_log_analytics_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,110 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests") # pylint: disable=line-too-long + 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,42 +135,37 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RequestRateByIntervalInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') + + request = build_export_request_rate_by_interval_request_initial( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -98,15 +180,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 + _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,14 +200,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( @@ -135,26 +225,22 @@ def begin_export_request_rate_by_interval( raw_result = self._export_request_rate_by_interval_initial( location=location, parameters=parameters, + api_version=api_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('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: @@ -164,48 +250,43 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export_request_rate_by_interval.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ThrottledRequestsInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ThrottledRequestsInput') + + request = build_export_throttled_requests_request_initial( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -220,15 +301,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 + _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,14 +321,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( @@ -257,26 +346,22 @@ def begin_export_throttled_requests( raw_result = self._export_throttled_requests_initial( location=location, parameters=parameters, + api_version=api_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('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: @@ -286,6 +371,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_export_throttled_requests.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_operations.py index 449d65f51fb..036fd0efac8 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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,47 +73,50 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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( + api_version=api_version, + 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( + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -94,7 +125,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +138,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.Compute/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.Compute/operations"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_proximity_placement_groups_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_proximity_placement_groups_operations.py index d37a24972b3..23bdc4d7fd8 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_proximity_placement_groups_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,249 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups") # pylint: disable=line-too-long + 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 +272,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,33 +298,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProximityPlacementGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -114,16 +337,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 + 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,33 +367,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,15 +402,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore - def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,26 +429,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,16 +457,17 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + 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. @@ -252,7 +475,7 @@ def get( :param proximity_placement_group_name: The name of the proximity placement group. :type proximity_placement_group_name: str :param include_colocation_status: includeColocationStatus=true enables fetching the colocation - status of all the resources in the proximity placement group. + status of all the resources in the proximity placement group. Default value is None. :type include_colocation_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ProximityPlacementGroup, or the result of cls(response) @@ -264,30 +487,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,53 +519,56 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -355,7 +577,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -364,60 +590,63 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -426,7 +655,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -435,7 +668,8 @@ 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/proximityPlacementGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_resource_skus_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_resource_skus_operations.py index 79098e40c5c..79c71638f68 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_resource_skus_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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,63 +86,62 @@ 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 - currently. + currently. Default value is None. :type filter: str :param include_extended_locations: To Include Extended Locations information or not in the - response. + response. Default value is None. :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.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -110,7 +150,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,7 +163,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_point_collections_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_point_collections_operations.py index 0036c84702c..3a47768cfa1 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_point_collections_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,257 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 +280,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,33 +309,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -119,16 +348,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 + 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,33 +378,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -186,42 +413,40 @@ 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( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -231,15 +456,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +475,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -268,24 +497,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -295,18 +518,18 @@ def get_long_running_output(pipeline_response): 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/restorePointCollections/{restorePointCollectionName}'} # type: ignore + 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. @@ -314,7 +537,7 @@ def get( :param restore_point_collection_name: The name of the restore point collection. :type restore_point_collection_name: str :param expand: The expand expression to apply on the operation. If expand=restorePoints, server - will return all contained restore points in the restorePointCollection. + will return all contained restore points in the restorePointCollection. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.RestorePointCollectionExpandOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: RestorePointCollection, or the result of cls(response) @@ -326,30 +549,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -362,57 +581,61 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -421,7 +644,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,58 +657,60 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -490,7 +719,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -499,7 +732,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_points_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_points_operations.py index f834a110d1d..570b45ac1d1 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_points_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,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 warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "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,46 +173,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '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) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -100,17 +220,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 + _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,14 +246,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( @@ -145,28 +272,22 @@ def begin_create( restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, parameters=parameters, + api_version=api_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('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: @@ -176,46 +297,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - 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 + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -225,16 +342,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +363,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -265,25 +386,18 @@ def begin_delete( resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, restore_point_name=restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_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: @@ -293,18 +407,18 @@ def get_long_running_output(pipeline_response): 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/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}'} # type: ignore + 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,29 +437,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -358,4 +469,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_galleries_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_galleries_operations.py index 6917433a7bf..269fa40a66f 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_galleries_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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]] + +_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}") # pylint: disable=line-too-long + 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) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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,61 +121,61 @@ 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. :type location: str :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. + listing operations. Default value is None. :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.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.SharedGalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -108,7 +184,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,18 +197,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 + 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,28 +226,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -179,4 +257,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_image_versions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_image_versions_operations.py index 1297376e430..3ea64f2f3ee 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_image_versions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}") # pylint: disable=line-too-long + 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) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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 +129,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. @@ -64,51 +148,55 @@ def list( Versions are to be listed. :type gallery_image_name: str :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. + listing operations. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -117,7 +205,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,20 +218,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 + 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,30 +257,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -200,4 +290,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 + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_images_operations.py index 3c0c1ec4af7..91abeef7335 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_shared_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,102 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}") # pylint: disable=line-too-long + 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) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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 +125,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. @@ -60,50 +140,53 @@ def list( :param gallery_unique_name: The unique name of the Shared Gallery. :type gallery_unique_name: str :param shared_to: The query parameter to decide what shared galleries to fetch when doing - listing operations. + listing operations. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] error_map = { 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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -112,7 +195,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -121,19 +208,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 + 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,29 +241,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,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}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_ssh_public_keys_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_ssh_public_keys_operations.py index 1d7054a2c8e..e877ffee7f6 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_ssh_public_keys_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair") # pylint: disable=line-too-long + 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,52 +304,53 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -99,7 +359,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,61 +372,64 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -171,7 +438,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,19 +451,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 + 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,33 +483,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SshPublicKeyResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -254,16 +522,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + 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,33 +552,29 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -321,15 +587,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore - def delete( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements 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,26 +614,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -375,15 +642,16 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + 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,28 +668,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,15 +699,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + 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,28 +728,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -495,4 +759,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 + + generate_key_pair.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_usage_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_usage_operations.py index 3b4a0e77607..2b8b192f17c 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_usage_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages") # pylint: disable=line-too-long + 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 +81,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. @@ -61,40 +97,40 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -103,7 +139,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,7 +152,8 @@ 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}/usages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extension_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extension_images_operations.py index bfe885ef191..620102d802b 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extension_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,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 warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from msrest import Serializer 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions") # pylint: disable=line-too-long + 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 +170,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,30 +199,27 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,15 +232,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 + 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,28 +259,25 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_types_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_types.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -168,19 +290,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 + 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. @@ -189,11 +313,11 @@ def list_versions( :type publisher_name: str :param type: :type type: str - :param filter: The filter to apply on the operation. + :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :param top: + :param top: Default value is None. :type top: int - :param orderby: + :param orderby: Default value is None. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineExtensionImage, or the result of cls(response) @@ -205,35 +329,29 @@ 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -246,4 +364,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 + + list_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extensions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extensions_operations.py index 0f937ffa0bd..067540d860b 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extensions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,232 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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,46 +257,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -104,17 +308,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 + _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,14 +335,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( @@ -150,28 +362,22 @@ def begin_create_or_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -181,52 +387,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,17 +440,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 + _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,17 +463,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( @@ -284,28 +494,22 @@ def begin_update( vm_name=vm_name, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -315,44 +519,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -362,16 +564,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +585,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -402,25 +608,18 @@ def begin_delete( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -430,19 +629,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + 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. @@ -451,7 +650,7 @@ def get( :type vm_name: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineExtension, or the result of cls(response) @@ -463,31 +662,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -500,23 +695,25 @@ 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 + 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. :type resource_group_name: str :param vm_name: The name of the virtual machine containing the extension. :type vm_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineExtensionsListResult, or the result of cls(response) @@ -528,30 +725,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -564,4 +757,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 + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_edge_zone_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_edge_zone_operations.py index 88f378aa845..6af9783177c 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_edge_zone_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,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 warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from msrest import Serializer 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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") # pylint: disable=line-too-long + 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 +256,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,32 +291,29 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,21 +326,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 + 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. @@ -145,12 +356,13 @@ def list( :type offer: str :param skus: A valid image SKU. :type skus: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :param top: An integer value specifying the number of images to return that matches supplied - values. + values. Default value is None. :type top: int :param orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineImageResource, or the result of cls(response) @@ -162,37 +374,31 @@ 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -205,16 +411,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 + 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,29 +442,26 @@ 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') - # 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) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -269,15 +474,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 + 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,28 +501,25 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_publishers_request( + location=location, + edge_zone=edge_zone, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,17 +532,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 + 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,30 +566,27 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -396,4 +599,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 + + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_operations.py index ede3461589d..fc2030fe5a4 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from msrest import Serializer 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus") # pylint: disable=line-too-long + 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 +246,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,31 +278,28 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,20 +312,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 + 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. @@ -138,11 +339,11 @@ def list( :type offer: str :param skus: A valid image SKU. :type skus: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str - :param top: + :param top: Default value is None. :type top: int - :param orderby: + :param orderby: Default value is None. :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of VirtualMachineImageResource, or the result of cls(response) @@ -154,36 +355,30 @@ 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,15 +391,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 + 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,28 +418,25 @@ 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') - # 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) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_offers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -255,14 +449,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 + 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,27 +473,24 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_publishers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -310,16 +503,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 + 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,29 +533,26 @@ 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + + + request = build_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,4 +565,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 + + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_run_commands_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_run_commands_operations.py index 5bd6b395fa2..329cb687851 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_run_commands_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,309 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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,55 +332,57 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -104,7 +391,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,18 +404,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 + 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,28 +433,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,50 +464,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + + 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", + *, + content_type: Optional[str] = "application/json", + **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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -235,17 +522,21 @@ def _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 + _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", + *, + content_type: Optional[str] = "application/json", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to create or update the run command. :param resource_group_name: The name of the resource group. @@ -257,16 +548,24 @@ def begin_create_or_update( :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -280,28 +579,22 @@ def begin_create_or_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -311,52 +604,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + 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", + *, + content_type: Optional[str] = "application/json", + **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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -369,17 +658,21 @@ 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 + _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", + *, + content_type: Optional[str] = "application/json", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the run command. :param resource_group_name: The name of the resource group. @@ -390,16 +683,24 @@ def begin_update( :type run_command_name: str :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandUpdate + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -413,28 +714,22 @@ def begin_update( vm_name=vm_name, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -444,46 +739,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -493,16 +784,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +805,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -533,25 +828,18 @@ def begin_delete( resource_group_name=resource_group_name, vm_name=vm_name, run_command_name=run_command_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -561,19 +849,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + 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. @@ -582,7 +870,7 @@ def get_by_virtual_machine( :type vm_name: str :param run_command_name: The name of the virtual machine run command. :type run_command_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineRunCommand, or the result of cls(response) @@ -594,31 +882,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,66 +915,71 @@ 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 + 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. :type resource_group_name: str :param vm_name: The name of the virtual machine containing the run command. :type vm_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -699,7 +988,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,7 +1001,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands'} # type: ignore + list_by_virtual_machine.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_extensions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_extensions_operations.py index 8e93c335c4b..73b6518464f 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") # pylint: disable=line-too-long + path_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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") # pylint: disable=line-too-long + path_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") # pylint: disable=line-too-long + path_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}") # pylint: disable=line-too-long + path_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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,46 +254,41 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -105,17 +305,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 + _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,17 +329,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( @@ -151,28 +360,22 @@ def begin_create_or_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -182,52 +385,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -244,17 +442,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 + _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,17 +465,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( @@ -289,28 +496,22 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -320,44 +521,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -367,16 +566,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +587,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -407,25 +610,18 @@ def begin_delete( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - '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: @@ -435,19 +631,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + 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. @@ -456,7 +652,7 @@ def get( :type vm_scale_set_name: str :param vmss_extension_name: The name of the VM scale set extension. :type vmss_extension_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetExtension, or the result of cls(response) @@ -468,31 +664,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -505,15 +697,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 + 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,45 +715,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -568,7 +765,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -577,7 +778,8 @@ 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/{vmScaleSetName}/extensions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 7e479c0df74..790d848466b 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,151 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[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. @@ -46,38 +174,36 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _cancel_initial( + def _cancel_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -87,15 +213,16 @@ def _cancel_initial( if cls: return cls(pipeline_response, None, {}) - _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + _cancel_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def begin_cancel( + + @distributed_trace + def begin_cancel( # pylint: disable=inconsistent-return-statements 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,14 +231,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -123,24 +253,18 @@ def begin_cancel( raw_result = self._cancel_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -150,42 +274,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _start_os_upgrade_initial( + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore + + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -195,15 +317,16 @@ def _start_os_upgrade_initial( if cls: return cls(pipeline_response, None, {}) - _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + _start_os_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def begin_start_os_upgrade( + + @distributed_trace + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements 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,14 +337,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -233,24 +359,18 @@ def begin_start_os_upgrade( raw_result = self._start_os_upgrade_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -260,42 +380,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_os_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _start_extension_upgrade_initial( + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore + + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -305,15 +423,16 @@ def _start_extension_upgrade_initial( if cls: return cls(pipeline_response, None, {}) - _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + _start_extension_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore - def begin_start_extension_upgrade( + + @distributed_trace + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements 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,14 +443,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,24 +465,18 @@ def begin_start_extension_upgrade( raw_result = self._start_extension_upgrade_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -370,17 +486,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_extension_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + 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,28 +513,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,4 +544,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 + + get_latest.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 80979afd63f..cf9575d4976 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,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 warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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,48 +273,43 @@ 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -106,18 +326,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 + _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,17 +352,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( @@ -155,29 +384,22 @@ def begin_create_or_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -187,54 +409,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,18 +464,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 + _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,17 +490,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( @@ -296,29 +522,22 @@ def begin_update( instance_id=instance_id, vm_extension_name=vm_extension_name, extension_parameters=extension_parameters, + api_version=api_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('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: @@ -328,48 +547,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -379,17 +594,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +618,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -423,26 +642,18 @@ def begin_delete( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, vm_extension_name=vm_extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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: @@ -452,20 +663,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + 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. @@ -476,7 +687,7 @@ def get( :type instance_id: str :param vm_extension_name: The name of the virtual machine extension. :type vm_extension_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVMExtension, or the result of cls(response) @@ -488,32 +699,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -526,17 +733,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 + 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. @@ -545,7 +754,7 @@ def list( :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. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVMExtensionsListResult, or the result of cls(response) @@ -557,31 +766,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,4 +799,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 + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions"} # type: ignore + diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 99a9df89223..ec02c9228a9 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,249 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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,48 +274,44 @@ 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", + *, + content_type: Optional[str] = "application/json", + **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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,18 +328,22 @@ def _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 + _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", + *, + content_type: Optional[str] = "application/json", + **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. @@ -131,16 +356,24 @@ def begin_create_or_update( :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -155,29 +388,22 @@ def begin_create_or_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -187,54 +413,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + 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", + *, + content_type: Optional[str] = "application/json", + **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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,18 +469,22 @@ 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 + _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", + *, + content_type: Optional[str] = "application/json", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineRunCommand"]: """The operation to update the VMSS VM run command. :param resource_group_name: The name of the resource group. @@ -271,16 +497,24 @@ def begin_update( :type run_command_name: str :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. :type run_command: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommandUpdate + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] lro_delay = kwargs.pop( @@ -295,29 +529,22 @@ def begin_update( instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -327,48 +554,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + template_url=self._delete_initial.metadata['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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -378,17 +601,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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,14 +625,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -422,26 +649,18 @@ def begin_delete( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, run_command_name=run_command_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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: @@ -451,20 +670,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + 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. @@ -475,7 +694,7 @@ def get( :type instance_id: str :param run_command_name: The name of the virtual machine run command. :type run_command_name: str - :param expand: The expand expression to apply on the operation. + :param expand: The expand expression to apply on the operation. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineRunCommand, or the result of cls(response) @@ -487,32 +706,28 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -525,17 +740,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 + 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. @@ -544,51 +761,55 @@ def list( :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. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -597,7 +818,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,7 +831,8 @@ 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/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vms_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vms_operations.py index c8e8406a1d5..a80f560dc58 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vms_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,27 +6,629 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class VirtualMachineScaleSetVMsOperations(object): +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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", 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): # pylint: disable=too-many-public-methods """VirtualMachineScaleSetVMsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,49 +650,46 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -99,17 +699,18 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore + - def begin_reimage( + @distributed_trace + def begin_reimage( # pylint: disable=inconsistent-return-statements 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,17 +720,23 @@ 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 + Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -143,25 +750,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -171,44 +772,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + 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( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -218,16 +817,17 @@ def _reimage_all_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore + - def begin_reimage_all( + @distributed_trace + def begin_reimage_all( # pylint: disable=inconsistent-return-statements 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,14 +839,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -259,25 +862,18 @@ def begin_reimage_all( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -287,44 +883,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + 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( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -334,16 +928,17 @@ def _deallocate_initial( if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore - def begin_deallocate( + + @distributed_trace + def begin_deallocate( # pylint: disable=inconsistent-return-statements 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,14 +951,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -376,25 +974,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -404,52 +995,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -466,17 +1052,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 + _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,14 +1078,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( @@ -511,28 +1105,22 @@ def begin_update( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + api_version=api_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('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: @@ -542,47 +1130,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements 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] + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -592,17 +1177,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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. @@ -612,18 +1198,21 @@ def begin_delete( :param instance_id: The instance ID of the virtual machine. :type instance_id: str :param force_deletion: Optional parameter to force delete a virtual machine from a VM scale - set. (Feature in Preview). + set. (Feature in Preview). Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -637,25 +1226,18 @@ def begin_delete( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, force_deletion=force_deletion, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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: @@ -665,19 +1247,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + 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. @@ -688,7 +1270,7 @@ def get( :type instance_id: str :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual - machine. + machine. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -700,31 +1282,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -737,16 +1315,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 + 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,29 +1345,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -800,18 +1377,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 + 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. @@ -820,59 +1399,63 @@ def list( :type virtual_machine_scale_set_name: str :param filter: The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied - eq true', 'properties/latestModelApplied eq false'. + eq true', 'properties/latestModelApplied eq false'. Default value is None. :type filter: str :param select: The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + Default value is None. :type select: str :param expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. + 'instanceView'. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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) @@ -881,7 +1464,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -890,48 +1477,46 @@ 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/{virtualMachineScaleSetName}/virtualMachines'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines"} # type: ignore - def _power_off_initial( + def _power_off_initial( # pylint: disable=inconsistent-return-statements 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] + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -941,17 +1526,18 @@ def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore + - def begin_power_off( + @distributed_trace + def begin_power_off( # pylint: disable=inconsistent-return-statements 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. @@ -964,18 +1550,21 @@ def begin_power_off( :type instance_id: str :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. + flag is false if not specified. Default value is False. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -989,25 +1578,18 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, skip_shutdown=skip_shutdown, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,44 +1599,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + 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( + def _restart_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1064,16 +1644,17 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore - def begin_restart( + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements 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,14 +1665,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1104,25 +1688,18 @@ def begin_restart( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,44 +1709,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + 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( + def _start_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1179,16 +1754,17 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore - def begin_start( + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements 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,14 +1775,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1219,25 +1798,18 @@ def begin_start( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,44 +1819,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + 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( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1294,16 +1864,17 @@ def _redeploy_initial( if cls: return cls(pipeline_response, None, {}) - _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def begin_redeploy( + + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements 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,14 +1886,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1335,25 +1909,18 @@ def begin_redeploy( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,19 +1930,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + 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. @@ -1387,7 +1954,7 @@ def retrieve_boot_diagnostics_data( :type instance_id: str :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. :code:`
    `:code:`
    `NOTE: If not specified, SAS URIs - will be generated with a default expiration duration of 120 minutes. + will be generated with a default expiration duration of 120 minutes. Default value is None. :type sas_uri_expiration_time_in_minutes: int :keyword callable cls: A custom type or function that will be passed the direct response :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) @@ -1399,31 +1966,27 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1436,42 +1999,42 @@ 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( + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore + + + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1481,16 +2044,17 @@ def _perform_maintenance_initial( if cls: return cls(pipeline_response, None, {}) - _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore + - def begin_perform_maintenance( + @distributed_trace + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements 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,14 +2065,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1521,25 +2088,18 @@ def begin_perform_maintenance( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), - 'instanceId': self._serialize.url("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,18 +2109,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore - def simulate_eviction( + @distributed_trace + def simulate_eviction( # pylint: disable=inconsistent-return-statements 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,27 +2139,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1609,50 +2168,47 @@ def simulate_eviction( if cls: return cls(pipeline_response, None, {}) - simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction'} # type: ignore + 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", + *, + content_type: Optional[str] = "application/json", + **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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RunCommandInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1667,17 +2223,21 @@ 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 + _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", + *, + content_type: Optional[str] = "application/json", + **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,16 +2248,23 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_07_01.models.RunCommandInput + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( @@ -1711,28 +2278,22 @@ def begin_run_command( vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, parameters=parameters, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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,6 +2303,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_sets_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_sets_operations.py index db6ad0c3303..9db71faee86 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_sets_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,27 +6,948 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class VirtualMachineScaleSetsOperations(object): +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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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): # pylint: disable=too-many-public-methods """VirtualMachineScaleSetsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,55 +969,57 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -104,7 +1028,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,51 +1041,47 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets'} # type: ignore + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets"} # type: ignore def _create_or_update_initial( self, - resource_group_name, # type: str - vm_scale_set_name, # type: str - parameters, # type: "_models.VirtualMachineScaleSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualMachineScaleSet" + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineScaleSet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -174,16 +1098,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 + _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,14 +1120,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( @@ -214,27 +1146,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + api_version=api_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('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: @@ -244,50 +1171,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,16 +1222,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 + _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,14 +1244,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( @@ -340,27 +1270,22 @@ def begin_update( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + api_version=api_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('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: @@ -370,45 +1295,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -418,16 +1340,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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. @@ -435,17 +1358,21 @@ def begin_delete( :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str :param force_deletion: Optional parameter to force delete a VM scale set. (Feature in Preview). + Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -458,24 +1385,18 @@ def begin_delete( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, force_deletion=force_deletion, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -485,18 +1406,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + 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. @@ -505,7 +1426,7 @@ def get( :type vm_scale_set_name: str :param expand: The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set - Create/Update operation. + Create/Update operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.ExpandTypesForGetVMScaleSets :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSet, or the result of cls(response) @@ -517,30 +1438,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -553,49 +1470,48 @@ 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( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + def _deallocate_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -605,16 +1521,17 @@ def _deallocate_initial( if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore + - def begin_deallocate( + @distributed_trace + def begin_deallocate( # pylint: disable=inconsistent-return-statements 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. @@ -623,18 +1540,24 @@ def begin_deallocate( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -647,24 +1570,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -674,51 +1592,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + 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( + def _delete_instances_initial( # pylint: disable=inconsistent-return-statements 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -728,17 +1642,18 @@ def _delete_instances_initial( if cls: return cls(pipeline_response, None, {}) - _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore - def begin_delete_instances( + + @distributed_trace + def begin_delete_instances( # pylint: disable=inconsistent-return-statements 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,20 +1661,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). + set. (Feature in Preview). Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -773,24 +1693,19 @@ def begin_delete_instances( vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, force_deletion=force_deletion, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -800,17 +1715,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + 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,28 +1742,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -861,57 +1773,61 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -920,7 +1836,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -929,58 +1849,60 @@ 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 + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -989,7 +1911,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -998,18 +1924,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 + 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,45 +1945,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -1065,7 +1995,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1074,18 +2008,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 + 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,45 +2028,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -1140,7 +2078,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1149,55 +2091,52 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - get_os_upgrade_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory'} # type: ignore + get_os_upgrade_history.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory"} # type: ignore - def _power_off_initial( + def _power_off_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1207,17 +2146,18 @@ def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def begin_power_off( + + @distributed_trace + def begin_power_off( # pylint: disable=inconsistent-return-statements 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. @@ -1228,20 +2168,26 @@ def begin_power_off( :type vm_scale_set_name: str :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. + flag is false if not specified. Default value is False. :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 + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1255,24 +2201,19 @@ def begin_power_off( vm_scale_set_name=vm_scale_set_name, skip_shutdown=skip_shutdown, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1282,51 +2223,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _restart_initial( + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # 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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1336,34 +2274,41 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore + - def begin_restart( + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements 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. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1376,24 +2321,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1403,51 +2343,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _start_initial( + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1457,34 +2394,41 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements 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. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1497,24 +2441,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1524,51 +2463,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _redeploy_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore + + def _redeploy_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1578,16 +2514,17 @@ def _redeploy_initial( if cls: return cls(pipeline_response, None, {}) - _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore + - def begin_redeploy( + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements 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. @@ -1595,18 +2532,24 @@ def begin_redeploy( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1619,24 +2562,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1646,51 +2584,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + 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( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1700,16 +2635,17 @@ def _perform_maintenance_initial( if cls: return cls(pipeline_response, None, {}) - _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - def begin_perform_maintenance( + + @distributed_trace + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements 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: @@ -1719,18 +2655,24 @@ def begin_perform_maintenance( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1743,24 +2685,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1770,48 +2707,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + 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( + def _update_instances_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1821,16 +2755,17 @@ def _update_instances_initial( if cls: return cls(pipeline_response, None, {}) - _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + _update_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore - def begin_update_instances( + + @distributed_trace + def begin_update_instances( # pylint: disable=inconsistent-return-statements 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,17 +2773,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1861,24 +2801,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -1888,51 +2823,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + 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( + def _reimage_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1942,16 +2874,17 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def begin_reimage( + + @distributed_trace + def begin_reimage( # pylint: disable=inconsistent-return-statements 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. @@ -1960,18 +2893,23 @@ def begin_reimage( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. - :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetReimageParameters + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1984,24 +2922,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -2011,51 +2944,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _reimage_all_initial( + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore + + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **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, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2065,16 +2995,17 @@ def _reimage_all_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore + - def begin_reimage_all( + @distributed_trace + def begin_reimage_all( # pylint: disable=inconsistent-return-statements 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. @@ -2082,18 +3013,24 @@ def begin_reimage_all( :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetVMInstanceIDs + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2106,24 +3043,19 @@ 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, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -2133,18 +3065,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + 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,29 +3097,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2200,16 +3129,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 - def convert_to_single_placement_group( + 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( # pylint: disable=inconsistent-return-statements 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 +3148,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,31 +3160,29 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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') - 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) + 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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2262,46 +3192,44 @@ def convert_to_single_placement_group( if cls: return cls(pipeline_response, None, {}) - convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + 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( + def _set_orchestration_service_state_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2311,16 +3239,17 @@ def _set_orchestration_service_state_initial( if cls: return cls(pipeline_response, None, {}) - _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + _set_orchestration_service_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore + - def begin_set_orchestration_service_state( + @distributed_trace + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements 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,14 +3260,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2351,24 +3284,19 @@ def begin_set_orchestration_service_state( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, parameters=parameters, + api_version=api_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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vmScaleSetName': self._serialize.url("vm_scale_set_name", 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: @@ -2378,6 +3306,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_orchestration_service_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + 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/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_sizes_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_sizes_operations.py index c51469cd55b..6439a7c0951 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_sizes_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,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 warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes") # pylint: disable=line-too-long + 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,56 +81,58 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -103,7 +141,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,7 +154,8 @@ 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}/vmSizes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"} # type: ignore diff --git a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machines_operations.py b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machines_operations.py index bf342e98964..6afeba78940 100644 --- a/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machines_operations.py +++ b/src/image-gallery/azext_image_gallery/vendored_sdks/azure_mgmt_compute/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,27 +6,931 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged 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 .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class VirtualMachinesOperations(object): +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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines") # pylint: disable=line-too-long + 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines") # pylint: disable=line-too-long + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct 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 = kwargs.pop('api_version', "2021-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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: + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json, text/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vmName": _SERIALIZER.url("vm_name", vm_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is 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): # pylint: disable=too-many-public-methods """VirtualMachinesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,55 +952,57 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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) @@ -104,7 +1011,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,51 +1024,47 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'} # type: ignore + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines"} # type: ignore def _capture_initial( self, - resource_group_name, # type: str - vm_name, # type: str - parameters, # type: "_models.VirtualMachineCaptureParameters" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -172,16 +1079,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 + _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,14 +1102,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( @@ -213,27 +1128,22 @@ def begin_capture( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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('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: @@ -243,50 +1153,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachine') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_type=content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -303,16 +1208,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 + _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,14 +1231,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( @@ -344,27 +1256,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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('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: @@ -374,50 +1281,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'VirtualMachineUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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, + api_version=api_version, + content_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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,16 +1332,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 + _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,14 +1354,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( @@ -470,27 +1379,22 @@ def begin_update( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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('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: @@ -500,45 +1404,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + 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( + def _delete_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -548,34 +1449,39 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements 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. + :param force_deletion: Optional parameter to force delete virtual machines. Default value is + None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -588,24 +1494,18 @@ def begin_delete( resource_group_name=resource_group_name, vm_name=vm_name, force_deletion=force_deletion, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -615,18 +1515,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + 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. @@ -637,6 +1537,7 @@ def get( snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. + Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_07_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -648,30 +1549,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str - # Construct headers - header_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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -684,15 +1581,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + 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. @@ -709,28 +1608,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -743,40 +1639,40 @@ 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( + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore + + + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -786,15 +1682,16 @@ def _convert_to_managed_disks_initial( if cls: return cls(pipeline_response, None, {}) - _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + _convert_to_managed_disks_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore - def begin_convert_to_managed_disks( + + @distributed_trace + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements 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. @@ -804,14 +1701,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -823,24 +1723,18 @@ def begin_convert_to_managed_disks( raw_result = self._convert_to_managed_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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,45 +1744,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_convert_to_managed_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + 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( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -898,16 +1789,17 @@ def _deallocate_initial( if cls: return cls(pipeline_response, None, {}) - _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore - def begin_deallocate( + + @distributed_trace + def begin_deallocate( # pylint: disable=inconsistent-return-statements 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. @@ -916,17 +1808,21 @@ def begin_deallocate( :param vm_name: The name of the virtual machine. :type vm_name: str :param hibernate: Optional parameter to hibernate a virtual machine. (Feature in Preview). + Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -939,24 +1835,18 @@ def begin_deallocate( resource_group_name=resource_group_name, vm_name=vm_name, hibernate=hibernate, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -966,17 +1856,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore - def generalize( + @distributed_trace + def generalize( # pylint: disable=inconsistent-return-statements 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 @@ -998,26 +1888,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1027,58 +1916,61 @@ def generalize( if cls: return cls(pipeline_response, None, {}) - generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.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, + api_version=api_version, + template_url=next_link, + ) + request = _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,7 +1979,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1096,63 +1992,65 @@ 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 + 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. :param status_only: statusOnly=true enables fetching run time status of all Virtual Machines in - the subscription. + the subscription. Default value is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + 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,7 +2059,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1170,18 +2072,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 + 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. @@ -1190,45 +2093,48 @@ 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-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, + api_version=api_version, + 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, + api_version=api_version, + template_url=next_link, + ) + request = _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,7 +2143,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1246,46 +2156,44 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes'} # type: ignore + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes"} # type: ignore - def _power_off_initial( + def _power_off_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1295,16 +2203,17 @@ def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - def begin_power_off( + + @distributed_trace + def begin_power_off( # pylint: disable=inconsistent-return-statements 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. @@ -1314,18 +2223,21 @@ def begin_power_off( :type vm_name: str :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. + flag is false if not specified. Default value is False. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1338,24 +2250,18 @@ def begin_power_off( resource_group_name=resource_group_name, vm_name=vm_name, skip_shutdown=skip_shutdown, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1365,44 +2271,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + 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( + def _reapply_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1412,15 +2314,16 @@ def _reapply_initial( if cls: return cls(pipeline_response, None, {}) - _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + _reapply_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore + - def begin_reapply( + @distributed_trace + def begin_reapply( # pylint: disable=inconsistent-return-statements 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. @@ -1429,14 +2332,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1448,24 +2354,18 @@ def begin_reapply( raw_result = self._reapply_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1475,42 +2375,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reapply.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + 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( + def _restart_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1520,15 +2418,16 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore + - def begin_restart( + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements 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. @@ -1537,14 +2436,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1556,24 +2458,18 @@ def begin_restart( raw_result = self._restart_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1583,42 +2479,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _start_initial( + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1628,15 +2522,16 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements 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. @@ -1645,14 +2540,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1664,24 +2562,18 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1691,42 +2583,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _redeploy_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore + + def _redeploy_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1736,15 +2626,16 @@ def _redeploy_initial( if cls: return cls(pipeline_response, None, {}) - _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def begin_redeploy( + + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements 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. @@ -1753,14 +2644,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1772,24 +2666,18 @@ def begin_redeploy( raw_result = self._redeploy_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -1799,51 +2687,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _reimage_initial( + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore + + def _reimage_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/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) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_reimage_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1853,34 +2738,40 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - def begin_reimage( + + @distributed_trace + def begin_reimage( # pylint: disable=inconsistent-return-statements 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. :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. :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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1893,24 +2784,19 @@ def begin_reimage( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + api_version=api_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): if cls: return cls(pipeline_response, 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: @@ -1920,18 +2806,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + 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. @@ -1940,7 +2826,7 @@ def retrieve_boot_diagnostics_data( :type vm_name: str :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with a value between 1 to 1440 minutes. :code:`
    `:code:`
    `NOTE: If not specified, SAS URIs - will be generated with a default expiration duration of 120 minutes. + will be generated with a default expiration duration of 120 minutes. Default value is None. :type sas_uri_expiration_time_in_minutes: int :keyword callable cls: A custom type or function that will be passed the direct response :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) @@ -1952,30 +2838,26 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1988,40 +2870,40 @@ 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( + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore + + + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2031,15 +2913,16 @@ def _perform_maintenance_initial( if cls: return cls(pipeline_response, None, {}) - _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + - def begin_perform_maintenance( + @distributed_trace + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements 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. @@ -2048,14 +2931,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2067,24 +2953,18 @@ def begin_perform_maintenance( raw_result = self._perform_maintenance_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, 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: @@ -2094,17 +2974,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def simulate_eviction( + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + + @distributed_trace + def simulate_eviction( # pylint: disable=inconsistent-return-statements 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. @@ -2121,26 +3001,25 @@ 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -2150,42 +3029,39 @@ def simulate_eviction( if cls: return cls(pipeline_response, None, {}) - simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'} # type: ignore + 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') + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2200,15 +3076,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 + _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. @@ -2217,14 +3095,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] lro_delay = kwargs.pop( @@ -2236,27 +3119,21 @@ def begin_assess_patches( raw_result = self._assess_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -2266,50 +3143,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_assess_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') + + request = build_install_patches_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2324,16 +3196,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 + _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. @@ -2341,17 +3215,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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( @@ -2364,27 +3245,22 @@ def begin_install_patches( resource_group_name=resource_group_name, vm_name=vm_name, install_patches_input=install_patches_input, + api_version=api_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('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: @@ -2394,50 +3270,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_install_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + 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", + *, + content_type: Optional[str] = "application/json", + **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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RunCommandInput') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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, + api_version=api_version, + 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) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2452,16 +3324,20 @@ 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 + _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", + *, + content_type: Optional[str] = "application/json", + **kwargs: Any + ) -> LROPoller["_models.RunCommandResult"]: """Run command on the VM. :param resource_group_name: The name of the resource group. @@ -2470,16 +3346,23 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_07_01.models.RunCommandInput + :keyword content_type: Media type of the body sent to the API. Possible values are: + "application/json" or "text/json". Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: 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 """ + api_version = kwargs.pop('api_version', "2021-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( @@ -2492,27 +3375,22 @@ def begin_run_command( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, + content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.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: @@ -2522,6 +3400,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + 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/src/image-gallery/setup.py b/src/image-gallery/setup.py index 9ef75c95b74..18306647a56 100644 --- a/src/image-gallery/setup.py +++ b/src/image-gallery/setup.py @@ -16,7 +16,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '0.1.2' +VERSION = '0.1.3' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers